Using multiple commands: sed
Posted: 2021-Jul-25, 12:27 pm
24 Jun 2012 12:38
shlinuxbash
Hello, SS64 !
I've got a question. If I wanted to operate on the word one for instance I would do a:
The same with two:
But when I try to replace both, I get this:
So, what am I doing wrong?
Thanks in advance, shlinuxbash
----------------------------
#2 24 Jun 2012 13:30
shlinuxbash
The desired output is:
1 2
----------------------------
#3 25 May 2013 10:43
Alfaq
----------------------------
#4 25 May 2013 12:48
foxidrive
GNUsed can do this
shlinuxbash
Hello, SS64 !
I've got a question. If I wanted to operate on the word one for instance I would do a:
Code: Select all
echo one two | sed s/one/1/
Output: 1
Code: Select all
echo one two | sed s/two/2/
Output: 2
Code: Select all
echo one two | sed s/one/1/ s/two/2/
Output: couldn't read file s/two/2/
Thanks in advance, shlinuxbash
----------------------------
#2 24 Jun 2012 13:30
shlinuxbash
The desired output is:
1 2
----------------------------
#3 25 May 2013 10:43
Alfaq
Code: Select all
echo one two | sed s/two/2/ | sed s/one/1/
#4 25 May 2013 12:48
foxidrive
GNUsed can do this
Code: Select all
echo one two | sed -e s/one/1/ -e s/two/2/