Perl XML, find matching condition and grep lines and put the lines somewhere else
Hi,
my xml files looks something like this
I need to grep all the lines between </Instance> and </Instance> {the 3 proeprty values, there cna be 4 or more, and place them on top between </Description> and <Instance, so it becomes like this
For the notes, There can be more than 1 parent in file. The Instance name will also be different than New York, but what I need to highlight is the string matching condition. In short, a complete file may look like this
In which case, the result needs to be like this
I wonder if this is possible, please help. Thank you very much.Really appreciate it.
Try this
For this to work you input document (example.xml) needs to be well-formed. Thus I have added a root element called "Instances".
Here is the stylesheet (example.xsl). This can handle any number of PropertyValue elements as requested.
and here is the result document
file input
aaaa,52C
aaaa,50C
bbbb,50C
bbbb,58C
aaaa,52C
bbbb,50C
aaaa,30C
bbbb,58C
cccc,60C
i want to print uniq lines with its max value of column2
expected output
aaaa,52C
bbbb,58C
cccc,60C
tks (4 Replies)
When I try with patern matching in a file with below code works
cat scj_drive_commands | egrep '/app/oracle/build_lib/pkg32|/app/oracle/build_lib/pkg33'
But when I have code with patern searching using of below does not work !
cat scj_drive_commands | egrep... (3 Replies)
Hi,
I need to make a script to extract the number that are not in a file.
Example:
I have file-A that has 100000 (70000-799999) numbers. And a file-B with number that already are in the system. Now I need to know/get the numbers that are not in system.
I was thinking something like this:... (5 Replies)
I need a way to extract data from
X 4T Solution 21 OCT 2011 37 .00
to account 12345678 User1 user2
X 4T Solution Solution Unlimited 11 Sep 2009 248 .00
to account 87654321 user3 user4
I need it to extract 'X' '37.00' and account number 12345678.
I have extracted above stuff... (3 Replies)
Hi,
I need to remove some lines from an XML file is the value within a tag is empty.
Imagine this scenario,
<acd><acdID>2</acdID><logon></logon></acd>
<acd><acdID></acdID><logon></logon></acd>
<acd><acdID></acdID><logon></logon></acd>
<acd><acdID></acdID><logon></logon></acd>
I... (3 Replies)
Hi folks
I am not allowed to install GNU grep on AIX.
Here my code excerpt:
grep_fatal () {
/usr/sfw/bin/gegrep -B4 -A2 "FATAL|QUEUE|SIGHUP"
}
Howto the same on AIX based machine?
from manual GNU grep
‘--after-context=num’
Print num lines of trailing context after... (4 Replies)
I'm a bit new to regex and sed/perl stuff, so I would like to ask for some advice. I have tried several variations of scripts I've found on the net, but can't seem to get them to work out just right.
I have a file with the following information...
# Host 1
host 45583 {
filename... (4 Replies)