Run sed on the last X lines of a file
Runs an inline sed to comment out the last seven lines of a file
sed -i "$(($(cat /etc/nagios/objects/commands.cfg | wc -l) - 7)),$(cat /etc/nagios/objects/commands.cfg | wc -l)s/^/#/" /etc/nagios/objects/commands.cfg
Written by Andrew Sledge
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Sed
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#