Jump to content

Featured Replies

Posted

hi all,

 

I am trying to replace all words containing underscore(s) using sed but I cannot. Every word containing underscores should be replaced with ---.

 

My text looks like:

 

Code:

This is VAR_1.

This is VAR_1_AND_VAR_2.

The output should be

 

Code:

This is ---.

This is ---.

I use the following command but I am unable to understand what is going wrong.

 

Code:

sed 's/[A-Z]+\_/---/g' file

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...