If I understand you correctly, this should work:
To introduce the new features in our match (search) string: . is regex for ANY character * is regex for the previous character can occur any number of times, from 0 on up
Replace string: & is like a variable, it expands out to the content of whatever your found \n is a newline
So we're searching for any lines containing "Secondary Ins." (escaped the . so it becomes a literal period, ensuring we won't match, e.g. "Secondary Insurance") and replacing them with themselves (simply put) and then adding a newline and a 1. Good?
Last edited by Franklin52; 12-07-2011 at 05:52 AM..
Reason: Please use code tags for code and data samples, thank you
Don't multipost. You already have a thread on this subject.
It's useful to know that he's using GNU sed on Windows, so probably can't use \n. He can't even split his regex across lines instead because it's being typed in a BAT file, not a shell script.
@ryan: Thank you very much! This works perfectly! It's exactly what I'm looking for. Your post is very helpful. I do appreciate you went into details and gave me an explaination for it. Thanks once again.
@Corona688: Sorry, I didn't mean to repost. I originally asked how to work with the bat file but I figured that out so I thought I need to focus on what the actual problem is and just ask for the code part.
@Corona688: Sorry, I didn't mean to repost. I originally asked how to work with the bat file but I figured that out so I thought I need to focus on what the actual problem is and just ask for the code part.
The syntax to type it into a batch file is often very different than how you'd type it into a real shell, and not actually using UNIX is really the sort of thing people should know when you ask a question about UNIX.
I had several solutions which would work in UNIX but wouldn't work in a batch file and eventually had to resort to awk. I suppose my version of sed is different from yours, even though they're both technically "GNU" sed.
hi,
i have /etc/inittab, I want to add another line after that when i find a pattern "l6:6:wait:/etc/rc.d/rc 6".
original
l6:6:wait:/etc/rc.d/rc 6
after-change
l6:6:wait:/etc/rc.d/rc 6
/sbin/if-pp-to-cng (3 Replies)
Platform: Solaris 10
I have a file like below
$ cat languages.txt
Spanish
Norwegian
English
Persian
German
Portugese
Chinese
Korean
Hindi
Malayalam
Bengali
Italian
Greek
Arabic
I want to append the string " is a great language" at end of each line in this file. (3 Replies)
Hello all,
after spending hours of searching the web I decided to create an account here. This is my first post and I hope one of the experts can help.
I need to resolve a grep / sed / xargs / awk problem.
My input file is just like this:
----------------------------------... (6 Replies)
here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb
cat dump.sql
INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
HI,
Can anyone help me with a script.
i/p
calc 1 2 3 4 5 6 7 8
calc 4 5 6 calc 7 8 9
o/p
calc 1 2 3 4 5 6 7 8
calc 4 5 6
i.e remove anything after where two times the string calc is found.
thanks (3 Replies)
Hi,
I need help for below scenario.I have a flat file which is having records seperated by delimiters which will represent each record for oracle table.My Control file will consider each line as one record for that table. Some of the lines are aligned in two/three lines so that records are... (4 Replies)
Hi,
I have two variables x and y.
i need to find a particular string in a file, a workflow name and then insert the values of x and y into the next lines of the workflow name.
basically it is like as below
wf_xxxxxx
$$a=
$$b=
$$c= figo
$$d=bentley
i need to grep the 'wf_xxxx' and then... (6 Replies)
Hello Everyone,
I just started scripting this week. I have no background in programming or scripting.
I'm working on a script to grep for a variable in a log file
Heres what the log file looks like. The x's are all random clutter
xxxxxxxxxxxxxxxxxxxxx START: xxxxxxxxxxxx... (7 Replies)
hi all , i have a requirement like this..
this just a sample script...
$ cat test.sh
#!/bin/bash
perl -e '
open(IN,"addrss");
open(out,">>addrss");
@newval;
while (<IN>)
{
@col_val=split(/:/);
if ($.==1)
{
for($i=0;$i<=$#col_val;$i++)
{
... (2 Replies)