Jul 20, 2005 #1 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
Need help with gsub command to remove one of the double quotes. Here my input: ""254"" like to print;: "254" Thanks
Jul 20, 2005 #2 vgersh99 Programmer Jul 27, 2000 2,146 US echo '""foo"' | nawk '{q="\""; gsub(/""/,q); print}' vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
echo '""foo"' | nawk '{q="\""; gsub(/""/,q); print}' vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Jul 20, 2005 #3 vgersh99 Programmer Jul 27, 2000 2,146 US or better yet: echo '""foo"' | nawk -v q='"' '{gsub(q q, q); print}' vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
or better yet: echo '""foo"' | nawk -v q='"' '{gsub(q q, q); print}' vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Jul 20, 2005 #4 vgersh99 Programmer Jul 27, 2000 2,146 US and multiple quotes: echo '""""""foo"' | nawk -v q='"' '{gsub(q q "*", q); print}' vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
and multiple quotes: echo '""""""foo"' | nawk -v q='"' '{gsub(q q "*", q); print}' vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Jul 20, 2005 Thread starter #5 sabetik IS-IT--Management Nov 16, 2003 80 GU 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" } Upvote 0 Downvote
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" }
Jul 20, 2005 Thread starter #6 sabetik IS-IT--Management Nov 16, 2003 80 GU Please ignore my lasy post. It is ok now. Thanks vgersh99 Upvote 0 Downvote
Jul 20, 2005 #7 vgersh99 Programmer Jul 27, 2000 2,146 US 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> | +----------------------------+ Upvote 0 Downvote
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> | +----------------------------+