[Ilugc] Shell Script - Help
- From: shan_karthic@xxxxxxxxx (Shankar Karthic Nagarathinam)
- Date: Sun, 25 Aug 2002 23:59:21 -0700 (PDT)
--- Ayyadurai_Nagarajan@xxxxxxxxxxxxxxxxxxx wrote:
Hi All,
I have the following string within a file .
<!ENTITY servers "5">
Can any one of you tell how to extract the
value 5? That is
any value loacted within the " " .
using bash
servers=`grep "<\!ENTITY servers" filename | cut -f2 -d\"`
where ` is the inverted quote found on the top left corner
of
the keyboard below the escape key, will assign the value to
the variable servers. u can later use ${servers} to refer
to this value.
This assumes that the dataline you are looking for has a
<!ENTITY servers string in it and that the value follows
the first double quote and ends before the second double
quote.
In case there are more than one <!ENTITY servers datalines
then the variable ${servers} will be a list of values which
can be processed using a for construct.
Lookup info or man for grep, cut and bash for further information.
__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
Other related posts: