It's the right idea - at least, it's how I would go about it - however, I think Franklin52 made a few typos, though, and one mistake.
First, s/6109/6105/; then, un-escape '<' and '>' ('\<' and '\>' have a meaning of their own; they match the empty string at the begging, end of a word). I would lose the '1' after the closing '}' as well; I think that's a typo (if I'm wrong and it does serve a purpose, someone please correct me...).
Keep in mind that the code as presented below doesn't need an explicit 'next' statement - you can include one, but you don't need to in this instance (it's implicit). If you ever have a need to skip to the next record immediately after doing something, though, use next; it's analogous to continue in a for loop.
Fix those minor issues and I think that code will do what you want it to do; that is, assuming that I'm understand correctly what you're trying to do. Restated, that code is:
Personally, I love awk for tasks of this nature.
- Larry
Last edited by Time2IPL; 10-18-2009 at 11:22 AM..
Reason: fix code tags
i have a file which contains data seperated by comma. i want to replace text after 3rd occurrence of a comma.
the input file looks like this
abcdef,11/02/2015 11:55:47,1001,1234567812345678,12364,,abc
abcdefg,11/02/2015 11:55:47,01,1234567812345678,123,,abc
abcdefhih,11/02/2015... (4 Replies)
I have a sample text format as given below
<Text Text_ID="10155645315851111_10155645333076543" From="460350337461111" Created="2011-03-16T17:05:37+0000" use_count="123">This is the first text</Text>
<Text Text_ID="10155645315851111_10155645317023456" From="1626711840902323"... (3 Replies)
Hey folks!
I am new to shell-scripting, but I have a problem that I would like to solve using a script. I create very large html forms, used for randomized trials. In these forms, each question is supplied with a variable that looks something like this: PROJECT_formNN
Where NN is the question... (1 Reply)
i am editing a big log file with the following pattern:
Date: xxxx Updated: name
Some log file text here
Date: eee Updated: ny
Some log file text here
Basically i want to remove all the text in a line before the "Updated" pattern. I sill want to print the other... (4 Replies)
Hello,
I have searched forum trying to find a solution to my problem, but could not find anything or I did not understand the examples....
I should say, I am very inexperienced with text processing.
I have a text file with approx 60k lines in it.
I need to merge lines based on the number... (8 Replies)
I have files on my AIX 4.2 client system where I need to do the following replacements below but have no clue how ? They are control characters (linefeed, chariage return, ...).
First, replace "^M^Y^M" with ^char_for_end_of_line
Then replace "^M" with " "
Trim all left spaces
In VI, my... (7 Replies)