12/29 Is there a command like 'tail' that will read a file backwards?
Tail does not do what I want because of a limited buffer size. I
want to read the *ENTIRE* file backwards. Less doesn't work because
it relies on line numbers and the file is corrupted. (Essentially,
I can read 1-n and n+EOF lines but n itself is corrupt.) More/less
lets me read 1-n, but tail won't let me go back far enough.
(tail -100000 and tail -3000 are equivalent because of the buffer)
\_ you could pipe it through a perl script that reads the file
backwards, i can write a multi line one, maybe one of the perl
geeks around here will post a 1-liner.
\_ Thanks! I found a PM called File::ReadBackwards that worked.
\- hello, you can use the "tac" command or sed '1\!G;h;$\!d' --psb
\_ Tac looks cool, but seems to be a Linuxism. It's not on
soda, for instance. (Yes, it could be ported.)
\-tac is a random hack that probably predates linux.
portability is why i added the sed cmd. --psb
\_ if you use 'less +G' it doesn't actually try to figure out line
numbers, it just goes to the end of the file. You can then scroll
back ward normally. -ERic
\_ I tried this and it did not work. I went to the end of the
file, but when I tried to scroll back it attempted to
calculate line numbers even when told not to. |