From: CSM 'illovae' Seldon on
rvaede <rvaedex23(a)gmail.com> writes:

> How can I extract the number from this line?
>
> <process_id>25752</process_id>
>
> I want to extract "25752"
>
> regards

You can use too GNU Sed :

$ echo "<process_id>25753</process_id>" | sed 's/<[^>]*>//g'

-- illovae.

--
CSM 'illovae' Seldon druuna (at) dud-t.org |
Member of dud-t group gopher://12.dud-t.org |
----------------------------------------------------{,_,"> |
---- Sic transit hominis regnum. Gens nova omnipoten. -----+
From: Sidney Lambe on
On comp.unix.shell, rvaede <rvaedex23(a)gmail.com> wrote:
> How can I extract the number from this line?
>
><process_id>25752</process_id>
>
> I want to extract "25752"
>
> regards

echo "<process_id>25752</process_id>" | sed -n 's|\(<[^>]*>\)\(.*\)\(<[^>]*>\)|\2|p'

Sid


From: andrew on
On 2010-05-06, rvaede <rvaedex23(a)gmail.com> wrote:

> How can I extract the number from this line?
>
><process_id>25752</process_id>
>
> I want to extract "25752"

A sed variant:

echo "<process_id>25752</process_id>" | sed "s/[^0-9]//g"

Andrew
--
Do you think that's air you're breathing?
First  |  Prev  | 
Pages: 1 2
Prev: crontab environment problem
Next: print head and tail