The UNIX and Linux Forums  

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


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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-19-2007 10:52 PM
Print Problem in UNIX. Need to know the option to specify the print paper size ukarthik HP-UX 1 06-07-2007 06:35 AM
how to print part of report ? Golive HP-UX 2 06-22-2005 07:29 AM
How to "Print Screen" from a dumb terminal on AIX? stembe UNIX for Advanced & Expert Users 3 11-15-2002 09:01 AM
Print The ouput From ls | grep "!!!" geoquest UNIX for Advanced & Expert Users 5 04-11-2002 02:45 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-27-2006
Registered User
 

Join Date: May 2004
Posts: 45
How do I get awk to print a " in it's print part?

The line is simple, use "[" as a field separator for the bits. What I need to do is put a " between $2 and $3.

I can't seem to figure out the escape character needed to get awk to actually print out the " and not think it's part of a bigger double ".

Any ideas?

awk -F[ '{ print $1"["$2$3 }' file.txt| awk -F] '{ print $1"]"$2"\"$3THE " NEEDS TO GO HERE$4 }'

I've tried \", "\, ^" and '"" but none of it works. What am I missing? Putting in the [ between $1 and $2 works fine, I just need to do the same with a ".

Thanks.
Reply With Quote
Forum Sponsor
  #2  
Old 06-27-2006
Registered User
 

Join Date: Mar 2006
Location: Nashville
Posts: 77
I'm not sure this is exactly what you wanted.

cat file | awk -F: '{print $1, $2, "\"", $3}'


sybqad0l 1706 " 546
sybbev0x 6218 " 542
wpati0k 8145 " 253
wembi02 4621 " 267
pimdp01 223 " 133
abainn1 7098 " 1141
abaibm1 7094 " 1141

-X
Reply With Quote
  #3  
Old 06-27-2006
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,249
Try...
Code:
awk '{print $3 "\042" $4}'
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:02 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0