Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More than 1 character as a FS

Status
Not open for further replies.

tdin

MIS
Jun 1, 1999
11
0
0
US
I have a file where I would like to use an entire word as a delimiter (i.e. group). Can that be done?

Also, I would like to prompt the user for the delimiter in a shell script and then use it in the awk program. I know I can read a variable into awk but I don't think it works in the BEGIN section. Thanks.
 
myDelim="foo"

nawk -v FS="${myDelim}" -f myAWK.awk
 
awk still doesn't seem to like FS of more than 1 character :-( Looks OK with nawk though.

Both awk & nawk still don't like RS > 1 char though, as mentioned in an earlier thread.

If it's FS you want, then

DELIM="group"
awk -F"$DELIM" -f awkscript filename

Greg.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top