Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
character replacement using sed/awk
Name: Rohit Date: September 11, 2004 at 19:53:44 Pacific OS: UNIX CPU/Ram: 1
Comment:
We have a tilde delimited file with tilde in the character data also. Character data is always in double quotes. For example
1~23~"abc"~1.1~"xy~x"
We need to change the tilde in character data to a dash, as below.
1~23~"abc"~1.1~"xy-x"
Can we do this using sed or a combination of sed and awk ?
if there's more than one substitution to be done in each line
0
Response Number 4
Name: Rohit Date: September 13, 2004 at 19:56:35 Pacific
Reply:
Thanks Wolfbone! Is "sub" a valid awk command on Unix ?
File does have multiple ~ that need to be delimited.
Thanks!
0
Response Number 5
Name: Wolfbone Date: September 13, 2004 at 22:16:01 Pacific
Reply:
Is "sub" valid? - Not sure what you mean but it's not a GNU only extension. "gsub" is standard too, in case you also have more than one '~' in any field.
Summary: I am trying to replace this line... strcpy(deletefile_name, string); with this one ... strlcpy(deletefile_name,string,strlen(deletefile_name); Basically, what I am doing is replacing the calls to strc...
Summary: I am using a ksh script to parse/analyze some text files - files that have records that are over multiple lines. I have used sed and awk in the past; however, I am having trouble with carriage returns...
Summary: I need help with either sed/awk or something else for unix replacing a set of numbers that is in the 2nd row and 3rd column of a file. these numbers represent a date "073006", I need to add the slash...