Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get 10th grouping value in sed?

Tags:

unix

sed

It is my sed.

sed 's/\([a-z]\)\([A-Z]\)\([0-9]\)\([a-z]\)\([A-Z]\)\([0-9]\)\([a-z]\)\([A-Z]\)\([0-9]\)\([a-z]\)/\10/g'

I tried to get 10th grouping value.But,It gives first grouping value with 0(zero).

How to get 10th grouping value?

whether it is possible to get the 10th grouping value?

like image 744
sat Avatar asked Jun 12 '12 08:06

sat


1 Answers

sed only supports 10 groups(from \0 to \9), and doesn't support non-captured group.

You can rewrite you command as:

sed 's/[a-z][A-Z][0-9][a-z][A-Z][0-9][a-z][A-Z][0-9]\([a-z]\)/\1/g'
like image 195
kev Avatar answered Nov 17 '22 06:11

kev