SED to extract characters

Hi,

Please let me know how do we write a piece of code to extract characters from a line using SED.

Are you meaning this type of extractions??

1)
$ echo "Red Hat Linux release 7.2 (Enigma)"
Red Hat Linux release 7.2 (Enigma)

**To extract the 7.2 from the above string
$ echo "Red Hat Linux release 7.2 (Enigma)" | sed 's/Red Hat Linux release \([0-9].*[0-9]\).*/\1/g'
7.2

2)
$ id | sed 's/uid=\([0-9]*\).*/\1/g'
64592

3)
$ echo "jadu[1023]" | sed 's/jadu\[\([0-9]*\).*\]/\1/g'
1023

Two same posts in the same forum.

Was that by mistake ?

Moderators please :slight_smile: