bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with changing FS


From: Ralf Wildenhues
Subject: Re: Problem with changing FS
Date: Sat, 15 Sep 2007 13:18:33 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

Hello Scott,

* Scott McNeilly wrote on Wed, Sep 12, 2007 at 05:40:25PM CEST:
> 
> line='dyn~11-SEP-07~isir_load_date'
> var=`echo $line | awk '{{ FS = "~"} { print $2}}'`

Try using instead
  var=`echo $line | awk 'BEGIN { FS = "~"} { print $2}'`

so that field splitting is done with the right field separator.
If you omit the BEGIN, the original value of FS is intact at the
time the first line is split.

Hope that helps.

Cheers,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]