Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > a simple 'awk' doesn't work?!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-07-07, 17:13
MonkeyMM MonkeyMM is offline
Registered User
 
Join Date: Jul 2007
Posts: 2
a simple 'awk' doesn't work?!



just want to replace the space and "go" in the sample file to No space and "GO", so I think something like follows would work, but not... couldn't figure out what's wrong... please help!

awk '{ sub(" go", "GO"); print}' test2.txt
awk: syntax error near line 1
awk: illegal statement near line 1
Reply With Quote
  #2 (permalink)  
Old 11-08-07, 05:17
mike_bike_kite mike_bike_kite is online now
Registered User
 
Join Date: Jun 2007
Location: London
Posts: 955
You'd do better just using the sed command

Code:
cat test2.txt | sed 's/ go/GO/'

Mike
Reply With Quote
  #3 (permalink)  
Old 11-09-07, 16:39
radoulov radoulov is offline
Registered User
 
Join Date: May 2007
Location: Milano, Italy
Posts: 22
On Solaris [/usr]/bin/awk is too old and broken.
Use nawk or /usr/xpg4/bin/awk.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On