Mar 31, 2004 #1 Larshg Programmer Joined Mar 1, 2001 Messages 187 Location DK Hi I trying to replace " and | I've usede something like this print '|' |awk '{gsub("|","-",$0); print }' But this does not work - I can't use | in gsub /Larshg
Hi I trying to replace " and | I've usede something like this print '|' |awk '{gsub("|","-",$0); print }' But this does not work - I can't use | in gsub /Larshg
Mar 31, 2004 #2 Ygor Programmer Joined Feb 21, 2003 Messages 623 Location GB Prefix with a backslash... print '|' |awk '{gsub("\|","-",$0); print }' Upvote 0 Downvote
Mar 31, 2004 Thread starter #3 Larshg Programmer Joined Mar 1, 2001 Messages 187 Location DK What if it is ' this version won't work - becouse awk think that ' endes the awk sentence echo ---|awk '{gsub("---","\'",$0); print }' Larshg Upvote 0 Downvote
What if it is ' this version won't work - becouse awk think that ' endes the awk sentence echo ---|awk '{gsub("---","\'",$0); print }' Larshg
Mar 31, 2004 #4 PHV MIS Joined Nov 8, 2002 Messages 53,708 Location FR Try this: echo ---|awk "{gsub(/---/,\"'\",$0); print }" Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 Upvote 0 Downvote
Try this: echo ---|awk "{gsub(/---/,\"'\",$0); print }" Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
Mar 31, 2004 Thread starter #5 Larshg Programmer Joined Mar 1, 2001 Messages 187 Location DK Can't get it to work > echo --- |awk "{gsub(/---/,\"'\",$0); print }" - > Larshg Upvote 0 Downvote
Mar 31, 2004 #6 Ygor Programmer Joined Feb 21, 2003 Messages 623 Location GB You can use the octal number of the ascii char ... echo ---|awk '{gsub("---","\047",$0); print }' Upvote 0 Downvote
Apr 1, 2004 #7 aigles Technical User Joined Sep 20, 2001 Messages 464 Location FR You can also define an awk variable : [tt] echo ---| awk '{gsub(/---/,Q);print}' Q="'" [/tt] Jean Pierre. Upvote 0 Downvote
You can also define an awk variable : [tt] echo ---| awk '{gsub(/---/,Q);print}' Q="'" [/tt] Jean Pierre.
Apr 1, 2004 #8 PHV MIS Joined Nov 8, 2002 Messages 53,708 Location FR Try this: echo X---|awk "{gsub(/---/,\"'\",$0); print }" I guess it's a echo problem Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 Upvote 0 Downvote
Try this: echo X---|awk "{gsub(/---/,\"'\",$0); print }" I guess it's a echo problem Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884