Archive for June, 2009
sed: Remove lines that match a pattern
Posted by JohannesTheDeveloper in fun with Linux on June 27th, 2009
sed '/mypattern/d' file
Deletes all lines that contain the regular expression “mypattern”.
In-place replacement:
sed --in-place '/mypattern/d' file1
sed also supports making backups with e.g. –in-place=.backup .
Jake
Posted by JohannesTheDeveloper in Happy Hacking on June 24th, 2009
Shutdown when idle
Posted by JohannesTheDeveloper in fun with Linux on June 20th, 2009
Maybe you want the computer to shutdown after it has done its task. This shuts down your Linux box when the load goes down to zero. Kind of like the “Speed” movies.
while ! cat /proc/loadavg |cut -f2 -d ' '|grep '0\.00'; do sleep 10m; done && poweroff
Alternatively:
while ps 12345; do sleep 10m; done && poweroff
Recent Comments