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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

awk file seperator

Status
Not open for further replies.

SpongeBob1

Programmer
Mar 1, 2002
49
0
0
US
Hi,

I wish to use the following as a file seperator

if (FS == "''" )

however I believe that awk has problems with the '' - does anybody know how to correct this error?

 
SpongeBob:

I see no reason why you can' use a FS or " if you want to:

awk -F"\"" ' { print $2 } ' file.txt

If file.txt looks like:

"field 1"field 2"field 3"

$2 equals

field 1

Regards,

Ed


 
Hi Olden,

Actually I meant... if (FS == "' '") the ' character is what i wish to seperate by as opposed to "... i think that awk interprets it as the end of the awk statement though, & am wondering how to avoid this....

 
SpongeBob:

Sorry, but I'm not understanding the question .....

Regards,

Ed
 
Hi Ed.

Sorry my question is unclear.... what I wish to do is use the single quotation as my file seperator, or rather use two single quotations i.e. ' ' as the file seperator, this however I am having problems with as I believe awk interprets a single guotation mark as the end of script. Hope this makes it clearer.
 
Thanks for your help Ed....

I'm using FS =' '

It did not need the double quotes....

thanks.
Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top