Skip to content

Instantly share code, notes, and snippets.

@spier
Created March 30, 2012 14:12
Show Gist options
  • Save spier/2251788 to your computer and use it in GitHub Desktop.
Save spier/2251788 to your computer and use it in GitHub Desktop.
sed issue

Input (in file input.txt)

some stuff
<fmt:message key="I_am_A"/> and some time later there is also <fmt:message key='I_am_B'/>
and even more stuff

Desired Output

I_am_A
I_am_B

How far I got:

grep "fmt:message" input.txt | sed -E 's/.*key=['\''"]([^'\''"]*)['\''"].*/\1/'

Which will output:

I_am_B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment