April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

sed one liners

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/10.49.5.61/10.49.5.62/g’ /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 Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>