>My favorite text editor for this is Excel with its Concatenate function.

bah, humbug !!!   Take your 40 Mbytes of $$$MS bloatware.exe and toss it in 
the Aral Sea. :)

With users.txt as a list of users, then with "cat" and "awk" from :

http://unxutils.sourceforge.net/


No need to edit, it's a One-Minute One-Liner (if you are a two-fingered typer):

cat users.txt | awk '{ print "T~" $1 ":$[EMAIL PROTECTED]"}' > aliases.txt

"But Len, my users.txt looks like this:

[EMAIL PROTECTED]

Am I screwed ?? "

Of course not. Just "cut" out field "1" using "@" as field delimiter :

cat users.txt | cut -d "@" -f 1 | awk '{ print "T~" $1 
":$[EMAIL PROTECTED]"}' > aliases.txt

===============

Another example:

A lazy Imail admin asked me how to generate DNS forward and reverse zone 
generic placeholder records for his RAS box's DHCP Class C without editing.

What he wanted in the reverse domain was a PTR record like:

10 PTR  dhcp10.mydomain.net.

... for all 255 records in that Class C

The (Bourne shell) script for that is:

#!/bin/sh

touch /tmp/db.dhcp.reverse

for i in `jot 255` ; do
echo $i | awk '{print $1" PTR dhcp"$1".mydomain.net."}' >> /tmp/db.dhcp.reverse
done
exit 0

In the output file:

1 PTR dchp1.mydomain.net.
2 PTR dchp2.mydomain.net.
3 PTR dchp3.mydomain.net.
.
.
.
255 PTR dhcp255.mydomain.net.

And for the forward domain:

#!/bin/sh

touch /tmp/db.dhcp.forward

for i in `jot 255` ; do
echo $i | awk '{print "dhcp" $1 " A a.b.c."$1}'  >> /tmp/db.dhcp.forward
done

exit 0

and gives:

dhcp1 A a.b.c.1
dhcp2 A a.b.c.2
dhcp3 A a.b.c.3
.
.
.
dhcp255 A a.b.c.255

Every one of  us has to deal with text files everyday (reporting, 
extracting, counting, transforming, re-formatting, generating, scripted 
editing, etc).  There is simply no better set of tools that the text 
processing commands from Unix.  and you can have them for free. and they 
work on Windows and *nix.

Don't be swine!!  Pick up on these pearls!!   :))

Len



To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/

Reply via email to