-F option for awk

Robert Shaw rjshaw at ramius.ocf.llnl.gov
Mon Aug 13 03:12:11 AEST 1990


When awk'ing something like a passwd file, where the reasonable choice
of field separator is something other than whitespace, how do you 
let a line simply fall through and be printed unchanged?

print; or print $0; don't do the right thing because the lines come
out with spaces as the field separators instead of the character given
to the -F option.

The best I can do at present is a printf. Something like

printf("%s:%s:%s:%s:%s:%s:%s\n",$1,$2,$3,$4,$5,$6,$7);

to get the colon's back out when operating on a passwd-format file, for
instance

===============================================================================
                                                       rjshaw at ramius.llnl.gov
            _____   ____   ____   ______  
   R o b   /    /  / / /  /   /  / / / /
 -------- /  --/  /   /  / / /  / / / / ---------------------------
         /--  /  / / /  /   /  /     /   S h a w    
        /____/  /_/_/  /_/_/  /_____/                      

 The Cosby's are precisely what's wrong with television today...
===============================================================================



More information about the Comp.unix.questions mailing list