sed

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

sed

vishnu
i want to replace u) with D) in a file provide in the same line contains Environment after u)

ex 1)-u)  Environment
2)u) dummy

In first example i need to replace since it contains the word Environment and no need to replace in second example

sed 's/u)/D)/g' filename.txt .not sure how to add enviornment condition
Reply | Threaded
Open this post in threaded view
|

Re: sed

Guru
Administrator
$ cat file
1)-u)  Environment 
2)u) dummy

$ sed 's/u)\(  Environment\)/d)\1/g' file
1)-d)  Environment 
2)u) dummy