Using Awk specify Unusual Delimiter


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Using Awk specify Unusual Delimiter
# 1  
Old 05-09-2012
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?
# 2  
Old 05-09-2012
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}'

This User Gave Thanks to shamrock For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Change delimiter is not working using awk

I have file 2.txt and I want to change the delimiter form , to : Not sure what is the problem with below command cat 2.txt 1,a 2,b 3,d awk 'BEGIN {FS=",";OFS=":";} {print $0}' 2.txt Please use CODE tags as required by forum rules! (11 Replies)
Discussion started by: vamsi.valiveti
11 Replies

2. Shell Programming and Scripting

awk removes delimiter unexpectedly

datafile: blah,blah,blah,blah,blah,blah,blah,blah,blah=0_nblah=0-- ,blah,blah,blah im using the following command to turn the "_n" and "-- " to just a space " " only in the $9th field. meaning, it has to make the changes only in the 9th column/field of the datafile. awk -F, '{... (1 Reply)
Discussion started by: SkySmart
1 Replies

3. Shell Programming and Scripting

Need to use delimiter as : and space in awk

Hi , Please suggest me how do I use : (colon and one space) as a delimiter in awk Best regards, Vishal (2 Replies)
Discussion started by: Vishal_dba
2 Replies

4. Shell Programming and Scripting

Need next line as a space delimiter in awk

Hi,Below is the output for p3fi_dev services 1/app/oracle> . ./oraprofile_p3fi_dev p3fi_dev_01 (P):/devoragridcn_01/app/oracle> srvctl config service -d p3fi_dev p3fi_p3fi_dev.world PREF: p3fi_dev_01 AVAIL: p3fi_dev_02 pplnet_p3fidev PREF: p3fi_dev_01 AVAIL: p3fi_dev_02 nexus_p3fidev PREF:... (3 Replies)
Discussion started by: Vishal_dba
3 Replies

5. UNIX for Dummies Questions & Answers

Help with awk using * (asterisk) as the delimiter

Hi I am trying to parse the following lines and has to use * (asterisk) as the delimiter. These lines are in a file, for example tmp.txt and I am using a while loop tmp.txt: 14-OCT-2012 06:38:59 *... (1 Reply)
Discussion started by: newbie_01
1 Replies

6. Shell Programming and Scripting

awk delimiter

I have several hundred files that look like this: ABB110405110000.rawfma8 AAB110405110001.rawhr32 If I use the statement ls | awk '{x=$0;gsub("","",x) I see that all characters other than 0-9 are eliminated but how do I eliminate all characters including numbers after the "." In my mind I... (1 Reply)
Discussion started by: rdburg
1 Replies

7. Shell Programming and Scripting

awk with multiple character delimiter

Hi all, I'm trying to split fields separated by multiple characters : Here's the string : "toto"||"ta|ta"||"titi" Here's what I want : "toto"||"ta|ta" I tried several ways, but it seems that my delimiter || is not working : echo "\"toto\"||\"ta|ta\"||\"titi\"" | awk 'BEGIN... (4 Replies)
Discussion started by: popawu
4 Replies

8. Shell Programming and Scripting

AWK double delimiter

Hello, an awk style question (or a stupid question... it depends on your point of view :) ) How can I write in one awk command these two ones ? $USER - `grep $USER /etc/passwd | awk -F: '{ print $5 }' | awk -F, '{ print $1 }'` Thanks gb (4 Replies)
Discussion started by: gogol_bordello
4 Replies

9. Shell Programming and Scripting

awk,nawk,sed, delimiter |~|

RECORD=NEW|~|VENDORN=LUCENT|~|VENDORM=CBX500_REAR|~|NETWORK=ATM|~|SUBNETWORK=N/A|~|SITE=CIL|~|REGION=KN|~|COUNTRY=PS|~|SWITCH=SWITCH1|~|E THERNET=N/A|~|LOOPBACK=N/A|~|SHELF=N/A|~|SLOT=14|~|SUBSLOT=N/A|~|STSCHAN=N/A|~|PORT=S14|~|DS1SLOT=N/A|~|LINE=N/A|~|LPORTID=N/A|~|CARDDESC=N/A|~|CARDTYPE=BAC2RT0... (7 Replies)
Discussion started by: knijjar
7 Replies

10. Shell Programming and Scripting

awk 2 delimiter nested

Hello All, This work could be very easy for you guys. I would really appreciate help. input file: output file: (Desired) What I am capable of doing: Command: cat inputfile | awk -F\| '{print "num="$1" value="$2" digits="$3" name1="$4" file="$5" code="$6}' > outputfile Result what I am... (5 Replies)
Discussion started by: onlyroshni
5 Replies
Login or Register to Ask a Question