unix - Can't extract pattern from filename -
getting errors following sed command:
echo 20130521_onepki_p107336_app.pfx | sed -e 's/_\([pp][0-9]+\)_/\1/'
instead of returning p107336
, returning full filenam 20130521_onepki_p107336_app.pfx
.
any ideas why happening, , how can restrict output pattern like?
the captures should escaped parentheses , can use case-insensitive match i
, also, replacing capture part captured part no changes made. 1 matches entire line , replaces captured pattern:
sed -e 's/.*_\([pp][0-9][0-9]*\)_.*/\1/'
Comments
Post a Comment