0

I have a line like this:

<option value="bo">Tibetan Standard, Tibetan, Central</option>

I want an output like this:

bo Tibetan Standard, Tibetan, Central

When I am trying to do with sed:

sed -r 's/.*value="(\S+).*">(\S+)<.*/\1 \2/'

It gives only:

bo Tibetan

Can anyone help me? Thanks in advance

1
  • <option value="bo">Tibetan Standard, Tibetan, Central</option> the line is like this Commented Jul 30, 2015 at 7:22

1 Answer 1

1

The following modification to your original sed should work:

sed -r 's_.*value="(.*)">(.*)</option>_\1 \2_'

The following example:

sed -r 's_.*value="(.*)">(.*)</option>_\1 \2_' <<< '<option value="bo">Tibetan Standard, Tibetan, Central</option>'

Prints the desired output:

bo Tibetan Standard, Tibetan, Central
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.