[X-Unix] Postfix howto

Victor Eijkhout eijkhout at cs.utk.edu
Tue Jan 6 00:44:40 PST 2004


At 9:23 +0100 2004/01/06, Kuestner, Bjoern wrote:
>Where cutlast10.sh is the script that does the job and should take input
>from standardout?

 From stdin, to stdout, probably.

I don't think any of the tthree solutions given so far work. I was 
kind of bummed that my solution, short as it was, needed to access 
the file twice, once to count the lines, and once to list them. In 
particular, it really needed a file, and couldn't be used in the 
middle of a pipe. However, awk to the rescue. Fill in the dots, and

awk 'v10 {print v10} {v10=v9} {v9=v8} ..... {v2=v1} {v1=$0}'

can actually be used between stdin and stdout.

I <heart> awk.
-- 
Victor Eijkhout <eijkhout at cs.utk.edu>, 329 Claxton, Comp Sci, UT, 
Knoxville TN 37996.
tel: 865 974 9308 (W), 865 673 6998 (H), 865 974 8296 (F)
http://www.cs.utk.edu/~eijkhout/



More information about the X-Unix mailing list