Edit Text Files on Linux without opened

command line add text to text file

echo "nameserver 103.4.175.254" >> /etc/resolv.conf 

command line Replace text to text file

sed -i 's/165.21.83.88/103.4.175.254/g' /etc/resolv.conf

sed -i 's/ntp.kim.lipi.go.id/ns1.myee.web.id/g'  >> /var/spool/cron/root

Remove blank lines using sed

sed '/^$/d' input.txt > output.txt

Leave a Reply

Your email address will not be published.