script to get the values from a file

August 24, 2011 at 22:08:25
Specs: Unix
I have a line in a file as follows:

<Woekinstnce name="abc" id="ab1">

some times the id field is not constant, it can be in the name place also.

I want to get the id value to be printed


See More: script to get the values from a file

Report •

#1
August 25, 2011 at 11:09:03
Assuming a file called datafile.txt:

sed 's/.*id="\(.*\)".*/\1/g' datafile.txt


Report •
Related Solutions


Ask Question