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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Double quotes

Status
Not open for further replies.

sabetik

IS-IT--Management
Nov 16, 2003
80
GU
Need help with gsub command to remove one of the double quotes.

Here my input: ""254""
like to print;: "254"

Thanks
 
echo '""foo"' | nawk '{q="\""; gsub(/""/,q); print}'

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
or better yet:
echo '""foo"' | nawk -v q='"' '{gsub(q q, q); print}'

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
and multiple quotes:

echo '""""""foo"' | nawk -v q='"' '{gsub(q q "*", q); print}'

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Sorry rusty in awk. here what I have:

BEGIN {
FS=OFS=","
}
{

for (i=NF-2; i <= NF; i++)
$i= "\"" $i "\""

#how can I inser the qusb here

print > "napm.dat"
}
 
Please ignore my lasy post. It is ok now.

Thanks vgersh99
 
nawk -v q='"' '
BEGIN {
FS=OFS=","
}
{
for (i=NF-2; i <= NF; i++)
$i= q $i q

#how can I inser the qusb here
gsub(q q "*", q)
print > "napm.dat"
}
'

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top