Friday, May 31, 2013

Perl one liner

Extracts "AAAAA-1_2" from the string "HI.A201.09CX.Index_1.AAAAA-1_2"

$ echo HI.A201.09CX.Index_1.AAAAA-1_2 | perl -ne '{ chomp($_); $foo = $_; $foo =~ s/(.*)(Index_.*)\.(.*)/\3/; print "$foo\n"; }'
AAAAA-1_2


No comments: