System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

sed -e works but sed -i not working

 
Highlighted
Regular Advisor

sed -e works but sed -i not working

I'm confused to the max on this one. running rhel3 on hp server. sed version 4.0.7-3. I run sed -e and the output is echo'ed to the screen properly. I run sed -i and the changes are not made.

B1110-> grep /usr/lbin/eod-error-chk.sh /home2/matt/root
0 5 * * 2-6 /usr/lbin/eod-error-chk.sh > /dev/null 2>&1

B1110-> grep /usr/lbin/eod-error-chk.sh /home2/matt/root | sed -e s/5/2/g
0 2 * * 2-6 /usr/lbin/eod-error-chk.sh > /dev/null 2>&1

B1110-> grep /usr/lbin/eod-error-chk.sh /home2/matt/root | sed -i s/5/2/g

B1110-> grep /usr/lbin/eod-error-chk.sh /home2/matt/root
0 5 * * 2-6 /usr/lbin/eod-error-chk.sh > /dev/null 2>&1
2 REPLIES 2
Highlighted
Regular Advisor

Re: sed -e works but sed -i not working

I ran the same command on a server running rhel4 and sed 4.1.2-6. I get this output.

[root@WSHQ-GFT01 tmp]# grep /usr/lbin/eod-error-chk.sh /tmp/root|sed -i 's/5/2/g
'
sed: can't read -: No such file or directory


that helps me understand where my problem is.
Highlighted
Regular Advisor

Re: sed -e works but sed -i not working

using wrong syntax.