Substitution till the end of the line in bash

Posted by Werner on Stack Overflow See other posts from Stack Overflow or by Werner
Published on 2010-03-16T14:20:32Z Indexed on 2010/03/16 14:26 UTC
Read the original article Hit count: 543

Filed under:
|

Hi,

I have a huge text file with lots of lines like:

asdasdasdaasdasd_DATA_3424223423423423
gsgsdgsgs_DATA_6846343636

.....

I would like to do, for each line, to substitute from DATA_ .. to the end, with just empty space so I would get:

asdasdasdaasdasd_DATA_
gsgsdgsgs_DATA_

.....

I know that you can do something similar with:

sed -e "s/^DATA_*$/DATA_/g" filename.txt

but it does not work.

Do you know how?

Thanks

© Stack Overflow or respective owner

Related posts about bash

Related posts about regex