Saturday 15 August 2015

sed - regex: not match a group rather than single characters -



sed - regex: not match a group rather than single characters -

echo test.a.wav|sed 's/[^(.wav)]*//g' .a.wav

what want remove every character until reaches whole grouping .wav(that is, want result .wav), seems sed remove every character until reaches of 4 characters. how trick?

groups not work within [], dot part of class parens.

how about:

echo test.a.wav|sed 's/.*\(\.wav\)/\1/g'

note, there may other valid solutions, provide no context on trying determine may best solution.

regex sed

No comments:

Post a Comment