I need your help for a specific sed command that would search for a multi line pattern and if found, would replace it by another multi line pattern.
For instance, here is the input:
The output would be:
I tried the following sed command:
It's not exactly what I want to do since I am replacing the matching pattern with only one line and not a block line. Besides, that command doesnt even work (I obtain the command garbled error message).
I can't simply search and replace on one hand the DefaultBinary field and the password on the other hand because I have to edit the DefaultBinary and password fields only when they are related to the user Paul. That why I need to use the multi line pattern matching.
Could someone give me some help ?
Thanks a lot and have a good day!
---------- Post updated at 05:03 AM ---------- Previous update was at 04:44 AM ----------
Update
I managed to make it work, Iwas executing the shell command with "launcher.mxres >>launcher.mres" at the end. There was missing a space.
Hence the following command works
But still, the command adds the entire line, how can I add a jump line after each xml tag? \n doesnt seem to work
---------- Post updated at 08:44 PM ---------- Previous update was at 05:03 AM ----------
Update!
With this command I managed to get it done:
But I have got another problem. I have got another file on which I have to make the same amendment. The problem on this file is that the block that i want to amend occurs several time. I would liek to make the amendment on every block in the file:
When I execute my command, there is a problem in the research pattern o this line "flex.*n48". The command takes basically everything after the first "flex" occurrence to the last "n48" occurrence.
It's the last step to get my work done, does someone have an idea please ?
Hi,
My problem is that I have to search a changing pattern and replace it with the wild card char "*"
i/p: 99_*_YYYYMMDD_SRC.txt.tar.gz
o/p: 99_*_*_SRC.txt.tar.gz
The problem is that YYYYMMDD pattern is not static. It could be YYYYMMDDHHMI or could be YYYYMMDDHHMISS.
Can... (10 Replies)
Hi Experts,
I had to edit (a particular value) in header line of a very huge file so for that i wanted to search & replace a particular value on a file which was of 24 GB in Size. I managed to do it but it took long time to complete. Can anyone please tell me how can we do it in a optimised... (7 Replies)
Hi,
I am looking for any script which can do the following.
have to read a pattern from fileA and copy it to fileB.
fileA:
...
...
Header
...
...
..p1
...
...
fileB:
....
....
Header (3 Replies)
Search and Replace a string pattern with empty in an xml file in unix:
My xml file would be like this :
<Accounts><Name>Harish</Name><mobile>90844444444444445999 </mobile><TRIG>srcujim-1</TRIG></Accounts><Accounts><Name>Satish</Name><mobile>908999</mobile><TRIG>ettertrtt-1</TRIG></Accounts>
... (1 Reply)
Hello All
I have a xml file with many sets of records
like this
<mytag>mydata</mytag>
<tag2>data&</tag2>
also same file can be like this
<mytag>mydata</mytag>
<tag2>data&</tag2>
<tag3>data2&data3</tag3>
Now i can grep & and replace with & for whole file but it will replace all... (4 Replies)
Hi guys,
got a problem here with sed on the command line.
If i have a string as below:
online xx:wer:xcv: sdf:/asdf/http:https-asdfd
How can i match the pattern "http:" and replace the start of the string to the pattern with null?
I tried the following but it doesn't work:
... (3 Replies)
Hi All,
I have a requirement where I have to find a pattern in a file and comment the whole line containing the search pattern. Any ideas in shell is welcome.
Thanks in advance,
Regards,
Arun (3 Replies)
Hello all
i have big test file that has allot of structure text something like this :
<foo1 *.html>
<blah action>
somthing 1
somthing 2
</blah>
</foo1 >
now i will like to insert 2 more lines of text below the <blah action>
so it will be like :
<foo1... (1 Reply)