Skip to navigation

Archive for the 'Sed' Category

Shell script to periodically check mail logs (and msmtpQ queue) and notify user by mail

Sunday, April 13th, 2008

As said in this previous post, I generally really like the speed of having
set sendmail_wait = -1
in my ~/.muttrc, but mutt doesn’t let me know if there are any error messages. That’s not good, and it would be ironic to gain a few seconds when hitting y in mutt just to nervously dig around in […]

Sed example 2

Monday, June 25th, 2007

Replacing whitespace, lifted directly from the handy collection of sed one-liners at Sourceforge:
Delete all leading whitespace from line (tabs and spaces):
sed ’s/^[ \t]*//’
Delete whitespace at end of line:
sed ’s/[ \t]*$//’
Delete leading and trailing whitespace:
sed ’s/^[ \t]*//;s/[ \t]*$//’

Sed example 1

Tuesday, May 1st, 2007

Many things are easiest to learn by looking at examples. I find this to be especially true for sed. Sed stands for “stream editor”, and it is very handy to perform bulk editing of text files. To get started, I refer you to this very nice tutorial. I’m planning to archive some of the small […]