wood burning stoves 2.0*
The moose likes Linux / UNIX and the fly likes need linux command. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "need linux command." Watch "need linux command." New topic
Author

need linux command.

praneeth ram
Ranch Hand

Joined: Sep 21, 2009
Posts: 60
test.xml.gz

<MyName Owner="Praneeth" Status="ALIVE">
<Empid>033516</Empid>
<DOB>2020</DOB>

command for one tag:----- zgrep '<EMPID>033516</EMPID>' test.xml.gz
i am getting expected result.


Now i want to search two tags <Empid>033516</Empid><DOB>2020</DOB> with the above command i am not getting expected result.
i know test.xml.gz contains both tags. but i am not getting this xml file.

can anyone please tell me the command to find the two tags.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

With -E you get extended grep, extended by regular expressions. "(a|b|c)" means "find a or b or c":

Another approach, if DOB always follows Empid, and 2020 is allways following 033516 is, to print one additional line of output:



A third solution would go for the xml-structure. There are tools to search in xml like xmlstarlet, but I don't know how to use them



Maybe there is something more simple out there, than xmlstarlet.


http://home.arcor.de/hirnstrom/bewerbung
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need linux command.
 
Similar Threads
Display table row value in another form
How to get environment variable ?
Regarding apply JOIN by using JPQL.
Array of HashMaps
Oracle date storage?