0

my input file contais this text

DOPC    1024
PW      30903
CL-     1
arg01   1

My output file should be

DOPC    1024
PW      100
CL-     10
arg01   1

I have used this following command for the single substitution and it works well.

read no_water
read length


sed s/"PW      30903"/"PW      $no_water"/ arg01.top >arg$length.top

But I want to do two substitutions by one sed command. Is it possible?
I have tried like this but it doesn't work

sed -e s/"PW      30903"/"PW      $no_water"/ ; s/"CL-     1"/"CL-     $length"/ <arg01.top >arg$length.top

Can anyone help me in this regard?

Edited by sudipta.mml

2
Contributors
6
Replies
20
Views
4 Years
Discussion Span
Last Post by sudipta.mml
0

thank you very much. It works.

Another thing, I have a file that contains this text

[ a_107081 ]
107081

I want to extract only a_107081 from this file using shell script. How do I do that. The grep and awk don't work here.

Edited by sudipta.mml

0

what's the pattern you're looking for ?
an a + an underline + any number of digits between square brackets?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.