Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-09-2012
Registered User
 
Join Date: Dec 2006
Posts: 496
Thanks: 264
Thanked 1 Time in 1 Post
Using Awk specify Unusual Delimiter


Code:
# echo "size(JFJF" |  awk -F"size(" '{print $1}'
awk: fatal: Unmatched ( or \(: /size(/

the delimiter is "size(" but i'm not sure if awk is the best tool to use to specify it.

i have tried:


Code:
# echo "size(JFJF" |  awk -F"size\(" '{print $1}'
awk: warning: escape sequence `\(' treated as plain `('
awk: fatal: Unmatched ( or \(: /size(/

any ideas?
Sponsored Links
    #2  
Old 05-09-2012
Registered User
 
Join Date: Oct 2007
Location: USA
Posts: 1,299
Thanks: 11
Thanked 99 Times in 95 Posts
Are you trying to print JFJF...in that case try this

Code:
echo "size(JFJF" |  awk '{FS="size\("; print $2}'

Or escape the backlash properly...

Code:
echo "size(JFJF" |  awk -F"size\\\(" '{print $2}'

The Following User Says Thank You to shamrock For This Useful Post:
SkySmart (05-09-2012)
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Unusual Behavior? vslewis HP-UX 3 08-13-2010 06:21 AM
Substring based on delimiter, finding last delimiter gupt_ash Shell Programming and Scripting 6 12-07-2009 07:30 AM
Unusual Problem proactiveaditya Shell Programming and Scripting 4 09-19-2009 11:57 AM
C Calender Help - Unusual error Octal Programming 3 03-26-2007 03:08 PM
very unusual question about while Terrible Shell Programming and Scripting 3 08-16-2006 02:21 AM



All times are GMT -4. The time now is 04:42 PM.