AWK field seperator question

Paul Krzyzanowski paul at alice.UUCP
Fri Feb 16 13:45:17 AEST 1990


In article <"900215154914.75046.606.CHD39-1"@CompuServe.COM>, 75046.606 at CompuServe.COM (Larry W. Virden) writes:
> I want to , within a particular pattern { action }, reset the
> Field Seperator, process the current record, then set the FS back
> to the default action.
> 
> To do this, I tried:
> /config/ {
>         FS = "\""; print $2 ;
>         FS = ""
>         next
> }
> 
> {
>         print $1, $2
> }

The program isn't doing what you want because you aren't "resetting"
the field separator.  Setting FS to an empty string doesn't reset
FS to its previous value;  you have to explicitely set it to use
white space as a separator.

Try           FS = " "
instead of    FS = ""


	-Paul Krzyzanowski
	 paul at allegra.att.com



More information about the Comp.unix.questions mailing list