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.
awk script for search and replace
Name: htnkd Date: July 26, 2005 at 07:38:25 Pacific OS: xp CPU/Ram: 1G
Comment:
I have a file with thousands of records in it. Each record in the file being of a fixed length of 190 bytes.
Example: 0003006315B000000002100601X646000000054717154-12700911700 00Telkwa Trailer Park 0003006317B000000003000601X646000000054717154-12700911700 00Tyhee Trailer Park 0003006613B000000002000601X646000000053242950-13181814600 00Beban Trailer Park 0003006848B000000006000601X646000000054163445-12542196600 00Freeport Trailer Park What I would like to do is for each record position 11 == B and somewhere starting at positon 80 for 49 bytes there is the word "Trailer". I want to replace position 28 for 3 with "xxx" for that record (Example X646 would become Xxxx). I want to do this for the entire file.
any help on how to get this to work. I am new to this and I have been doing sed on each individual record and this would take forever.
Name: htnkd Date: July 26, 2005 at 10:41:20 Pacific
Reply:
thanks-- if you have a word with "No." how can I get a search with the "." instead of everything with "No"
thanks for the help above
0
Response Number 3
Name: Jim Boothe Date: July 26, 2005 at 11:12:34 Pacific
Reply:
For example, in the two lines below, you want only the first line:
No. America North America
In regular expressions, a dot means any single character. You need to precede the dot with a backslash which will "escape" its special meaning and be taken as an actual dot:
Summary: Is it possible to do search and replace in unix Like : s/some date/current date/g some date and current date both are in same format (dd/mm/yyyy hh:mm:ss) My requirement is : I am having a variable w...
Summary: Hi, I intend to do a search and replace for specific words for files under a directory (inclusive of subdirectories). I know how to do that file by file using sed and redirect it to the original file....
Summary: I am working w/ this huge matrix file. Now in this matrix file 2nd column is strings. lets say its contain red, blue, black. now i can not load this file in matlab. so i wanted to change red to 1 bl...