sed -i 's/fea/asd/g' hello.txt | sed "/bam/ s/foo/bar/" # Replace foo with bar on lines contain 'bam' | sed -i '1s/^/head2\n/' file1

sed -i 's/fea/asd/g'  hello.txt
g: Global
s: substitute
-i : realtime works with file
---
sed "/bam/ s/foo/bar/" # Replace foo with bar only on lines that contain 'bam'.


#add text at the begining

sed -i '1s/^/head2\n/' file1

Comments

Popular posts from this blog

HAproxy logging

tomcat catalina coyote jasper cluster

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all