I am fairly new to UNIX coding and I have a file that I need to read in reverse line by line. The file has sections of code within {}. Then I need to run an awk script with this reversed file as the input. I am having our support staff install tac, but before they do I want to know if it will output what I need or if anyone can suggest an alternative.
The file has data in the form:
page 0 0 0 none
{
layer 0 0 0 "1line" 0 8 8 3
{
sector 0 -1 0 32
{
point_name 0 0 34543 34 44 1 1 0
status 1 0 1 0 1 431232 "transformer" 23 12
analog 1 0 1 0 1 321234 11.5 43 1 1 0
...
...
...
device 1 0 1 "ground" 32 56 1 1 0
}
}
}
and I want to preserve the {} but reverse the lines between the {} so the out put looks like:
page 0 0 0 none
{
layer 0 0 0 "1line" 0 8 8 3
{
sector 0 -1 0 32
{
device 1 0 1 "ground" 32 56 1 1 0
...
...
...
analog 1 0 1 0 1 321234 11.5 43 1 1 0
status 1 0 1 0 1 431232 "transformer" 23 12
point_name 0 0 34543 34 44 1 1 0
}
}
}
Also, does tac overwrite the input file or does it save it as a different file?