> How do I cut a word out of a line with sed? The word end with a '_'. I
> don't know, how to match word boundaries. I need "sample" 
> out of a sample_ line.

that blanks in the char class brackets are [ \t] (space and  tab)
you could expand the chars that can be part of a word, e.g. 0-9

cpuc% cat | sed 's/(^|[         ]+)[A-Za-z][A-Za-z_]*_([        ]+|$)/ /g'
this is a test_
this test_ is another
test_ this case too
test_test shouldn't get deleted
multiple test_ should also test_ work

this is a 
this is another
 this case too
test_test shouldn't get deleted
multiple should also work


Reply via email to