Solved sed -i does not work

Hello.
sed -i does not work
How do I delete or replace the same in file?
Linux sed -i '/pass/d' files.txt it work.
 
FreeBSD's sed(1) requires an argument to -i. On Linux's sed(1) that argument is optional.

sed -i '' ... works on both Linux and FreeBSD.
 
Code:
#!/bin/sh
TM=`date +"%H-%M"`
DOM=`cat /mnt/test_dom`
for f in $DOM
do
        if curl -Is --connect-timeout 5 https://$f 2>/dev/null; then
        else
            echo "Domain "$f" block, time ${TM}." | mail -s "Domain "$f" block, time ${TM}." [EMAIL]local@mail.local[/EMAIL]
            sed -i '/$f/d' /mnt/test_dom
        fi
done
exit 0
Sed does not work.
Domain is not removed from the list (/mnt/test_dom).
 
Nope, your syntax is still wrong. The examples given in this thread are correct. But to understand what the (required) parameter to -i does, just read the manpage. That's what theses pages are written for…
 
Nope, your syntax is still wrong. The examples given in this thread are correct. But to understand what the (required) parameter to -i does, just read the manpage. That's what theses pages are written for…
The old script was mistaken.
sed -i '' -e '/$f/d' /root/test_dom
I don’t understand why it doesn’t work
 
In my opinion it is misleading to have the words "quoting" and "simple" in one sentence :-/. From my perspective users who have no issues with quoting have reached the status of a guru. At least.
 
Back
Top