October 2001
Intermediate to advanced
1040 pages
22h 50m
English
If you open a pipe in an awk program, you must close it before opening another one. The command on the right-hand side of the pipe symbol is enclosed in double quotes. Only one pipe can be open at a time.
(The Database) % cat names john smith alice cheba george goldberg susan goldberg tony tram barbara nguyen elizabeth lone dan savage eliza goldberg john goldenrod (The Command Line) % nawk '{print $1, $2 | "sort –r +1 –2 +0 –1 "}' names (The Output) tony tram john smith dan savage barbara nguyen elizabeth lone john goldenrod susan goldberg george goldberg eliza goldberg alice cheba |
EXPLANATIONAwk will pipe the output of the print statement as input to the UNIX sort command, which does a reversed sort using the second ... |
Read now
Unlock full access