rsk@s.cc.purdue.edu (Frozen Wombat) (01/13/88)
This is just a quickie designed to solve a simple problem. Our site
runs elm, but some neighboring sites which I frequently use do not.
Since I would like to have all my mail aliases handy when using Elm (here)
or Ucbmail (there), but I don't want to maintain two alias databases,
I came up with this script + awk file that does 95% of the job automatically,
leaving you to do a little cleanup. What it does is to convert an
Elm .alias_text file to a .mailrc file. Of course, if you set any of
the options in Berkeley mail, for example, "askcc", you'll have to remember
to put those back in.
I didn't shar this 'cause it's so short; the shell script is a one-liner:
awk -F: -f alias.awk < .alias_text | sed -e "s/,//g"
Difficult, eh? Well, here's the awk file ("alias.awk")
BEGIN { }
/^.*:.*/ {
printf "alias %s\t%s\n", $1, $3
next
}
/.*/ {
printf "%s\n", $0
}
END { }
The cleanup that you'll have to do involves multi-line aliases; they'll
come out like this:
alias FOO bar blap bazz
fu foo zoo bar
...and so you'll need to add a backslash at the end of each line which
should be continued, e.g.:
alias FOO bar blap bazz \
fu foo zoo bar
If anyone can figure out how to the last 5% of the job, I'd be happy
to hear about it. I'm pretty satisfied with this (so far); it lets
me keep both sets of aliases up to date without having to type everything
twice.
Cheers,
Rich Kulawiec, rsk@s.cc.purdue.edu, s.cc.purdue.edu!rsk
PUCC Unix Staff