gorilon February 2016
Sed substitution with back reference not working
I receive output from a program as tab separated values, of which I am trying to obtain the second only using sed. I am currently using this:
sed -r -e "s/(^[^\t]+\t)([^\t]+\t)(.*$)/\2/"
However it does not seem to find matches. I have tried it in rubular were it does give me the match I want.
Lars Fischer February 2016
There is a specialized tool for selecting columns from text files called cut:
cut -f2 file
Here we instruct it to select only the second column, see the manpage for more information. Tab is the default column separator.
Asked in February 2016
Viewed 1,670 times
Answered 1 times
Leave an answer
Quote of the day: live life