Operating System - Linux
1753972 Members
7994 Online
108811 Solutions
New Discussion юеВ

sed -e works but sed -i not working

 
Matt Shaffer_1
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
Matt Shaffer_1
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.
Matt Shaffer_1
Regular Advisor

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

using wrong syntax.