awk field separator

MYERS ufpsprod!gmyers at atlml1.attmail.com
Thu Feb 22 15:46:55 EST 1996


} Hey folks,
} 
} Is there a way in awk to specify multiple field separators?  Like FS =   
} ";" | ":" | "\"  I know this doesn't work, I just wanted to show what I'm   
} trying to accomplish.  BTW, FS=";:\" doesn't work B/C it thinks I mean   
} the entire string ";:\".  Has anyone tackled a problem like this before.
} 
} Thanks,
} 
} Ferrol  
} 
} 
} ===================================================================
} Ferrol R. Blackmon, Software Development
} Systems Techniques, Inc.
} (404) 814-3877
} ===================================================================

Yes, try this:

gawk -F '[;:]' '{print "Frog"}'

I have not included the '\' character, because it can cause problems
because it is generally the escape character.  You can very well add
many more characters inside the square brackets.  You can also use
meta characters as in '[a-z]' if you want to use the whole lower
case alphabet as delimiters. (why?) :)


       Until later,       attmail!gamyers      ph  404.810.3250
       Geoffrey Myers                          fax 404.810.2487

       floc 6E26, 1200 Peachtree, Promenade II, Atlanta, GA 30309

      gamyers at attmail.com   geof at denali.is.net   eiger at ichange.com






More information about the Ale mailing list