sed one liners
Insert character at beginning of line

Example: comment out all nfs entries in /etc/fstab

sed -i ‘/nfs/s/^/#/’ /etc/fstab

Uncomment out all nfs entries in /etc/fstab

sed -i ‘/nfs/s/^#//g’ /etc/fstab

Make a copy of a file, then substitue a string in the original

perl -i.orig2 -p -e ‘s/’ /etc/fstab

Print contents of a file between lines 1 and 609

sed -n ‘1,609’p /var/log/tspulsemail.log > index.html

Leave a comment

Your email address will not be published. Required fields are marked *

Blue Captcha Image


Protected by WP Anti Spam

Hit Counter provided by dental implants orange county