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!

SunOS - awk -F does not work

Status
Not open for further replies.

lhg1

IS-IT--Management
Mar 29, 2005
134
0
0
DK
Hi

On a SunOs 5.10 this awk command does not work.

Code:
echo $0|awk -F "_" '{print $1}'

gives me this error
awk: syntax error near line 1
awk: bailing out near line 1

I don't know the awk version. What i looking for is an sed command that can do the same, or any other way of dooing it.

All i realy want to do is to get the echo everything before "_" out

ex.
Code:
>echo Hello_world|awk -F "_" '{print $1}'
Hello
>

Regards
Lars
 
What about this ?
Code:
echo Hello_world | nawk -F "_" '{print $1}'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Perfect

Thanks
 
Also this should work (note no space between -F and parameter):

Code:
echo $0| awk -F"_" '{print $1}'

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top