Jump to content
  • 0
dtaara

sed src/xxx/yyy/aaa replace to src/xxx

Question

Hi,

 

Please can anyone help me how to sed and replace 

src/xxx/yyy/aaa and replace to src/xxx ?

 

 

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
29 minutes ago, dtaara said:

Hi,

 

Please can anyone help me how to sed and replace 

src/xxx/yyy/aaa and replace to src/xxx ?

 

 

Hi,

Let's take the string hello world world for an example.

You can replace a single instance of world to Bob as follows:

$ echo 'hello world world' | sed 's/world/Bob/'

image.png.99a53a51895b8412fa2b7ff5c59f7d2e.png

 

If you want to replace all instance of world to Bob, then add a g flag at the end of sed expression as follows:

$ echo 'hello world world' | sed 's/world/Bob/g'

image.png.8434f07637b4a22d9f1cd99379c29d59.png

 

That's the basics of sed. I hope this helps.

If you have any questions, fell free to ask. 

 

Thanks

Shovon

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...