The input file i am testing with has just one line in it:
This xml fragment is actually part of a web request recorded by a load testing tool. Since there are several places within the web request that numbers can occur, it is important to identify the surrounding tags <int> and </int> when matching pattern.
I did not understand your command but modified it slightly to remove the reference to 163:
This returned an error:
I am testing this on windows with sedforwindows utility.
What does "N;s:>" , "<:>" parts and "<:2" of your command mean ?
Thanks.
---------- Post updated at 05:23 PM ---------- Previous update was at 04:28 PM ----------
A correction:
The input file (r.txt) i am testing with has just one line in it:
This xml fragment is actually part of a web request recorded by a load testing tool. Since there are several places within the web request that numbers can occur, it is important to identify the surrounding tags <int> and </int> when matching pattern.
The numbers can be different each time the request is recorded.
I did not understand your command completely but modified it slightly to remove the reference to 163:
This returned an error:
I am testing this on windows with sedforwindows utility.
What does "N;s:>" , "<:>" parts and "<:2" of your command mean ?
Thanks.
---------- Post updated 01-08-11 at 12:35 PM ---------- Previous update was 01-07-11 at 05:23 PM ----------
Here is a rough sample of an input web request :
I am interested in replacing the pattern <int>163</int>\n <int>30</int> within this web request.
Note the numbers between the tags <int> and </int> can be anything. Also there are several places where numbers occur in this web request.
I tried the following sed command and it worked only if I removed the newline and the multiple spaces (there can be any number of them) between the two repeating patterns <int>number</int>.
For this sed command to work I had to alter the input web request to:
I want to retain the newlines and the spaces(however many of them) occurring between the two repeating elements. How can I alter my sed command to achieve this ?
Desired output:
Thanks.
Last edited by Scott; 01-11-2011 at 12:49 PM..
Reason: Please use code tags
There is no newline between the patterns<int>163</int> and <int>30</int>\n in your input request :
What the input request should be:
It is when I include that newline and a few spaces between <int>163</int> and <int>30</int>\n that the sed code does not work...
Dear Unix Forums,
I am hoping you can help me with a pattern matching problem.
What am I trying to do?
I want to replace multiple lines of a text file (that match a multi-line pattern) with a single line of text. These patterns can span several lines and do not always have the same number of... (10 Replies)
Hi,
Iam using ksh and trying to execute the following syntax to replace one word of the sentence with a new word. But somehow sed is not able to replace the old value with new value. Please let me know where Iam going wrong.
Sample Code :
-->
export line="VORTEX,abcdef"
export... (3 Replies)
We have 2 file XML files - FILE1.XML and FILE2.xml - we need copy the contents of FILE1.XML and replace in FILE2.xml pattern "<assignedAttributeList></assignedAttributeList>"
FILE1.XML
1. <itemList>
2. <item type="Manufactured">
3. <resourceCode>431048</resourceCode>
4. ... (0 Replies)
If the string is of the pattern XxxXyzAbc...
The expected out put from sed has to be Xxx Xyz Abc ...
eg: if the string is QcfEfQfs, then the expected output is Qcf Ef Efs.
If i try to substitute the pattern with space then the sed will replace the character or pattern with space,... (1 Reply)
how would you get SED to do the following, say you have the following lines in a text file:
user=tigger
some text some text
some text some text
some text some text
user=ted
some text some text
some text some text
some text some text
user=thekingofrockandroll
you want to find any line... (15 Replies)
Hello,
let's start by giving you guys a few examples of the text:
"READ /TEXT123/ABC123"
"READ /TEXT123/ABC123/"
"READ TEXT123/ABC123"
"READ TEXT123/ABC123/"
"READ TEXT123/TEXT456/ABC123"
"READ /TEXT123/TEXT456/ABC123"
"READ /TEXT123/TEXT456/ABC123/"
TEXT and ABC can be and I... (5 Replies)
I am using this concept to fetch value of IP address after node= in this line of csv text:
a="Measurement:,OutInviteResponseTime,Sessionid=1860700092328051458,node=67.178.40.168,nodeName=abcd,protocol=GK,25523000"
echo $a | sed 's/.*node=\(.*\).*/\1/'
But this outputs:
... (10 Replies)
Hello,
The following sed command is giving error
sed: -e expression #1, char 13: unknown option to `s'
The sed command is
echo "//-----" | sed "s/\/\/---*/$parChk/g"
where parChk="//---ee-"
How can i print the variable value from sed command ?
And is it possible to replace a... (2 Replies)
I would like to use sed to replace one occurence of a pattern in a file. When I use the s/// command it replaces all occurences of the pattern in the file. Should I be using something other than sed?
Thanks (6 Replies)