perl to python

Ralf Muschall ralf at tecont.de
Wed May 12 08:18:15 EDT 2004


Kirk Job-Sluder <kirk at eyegor.jobsluder.net> writes:

> I still find: 
> awk 'BEGIN {FS="\t"} {printf("pattern", $1,$4,$3,$2)}' file 

> to be more elegant and easier to debug.  It does the required task in
> two easy-to remember statements.

It misses the "-i" thing.  You have to wrap it:

NEWNAME=mktemp foo.XXXXXX
mv file $NEWNAME
your_awk $NEWNAME > file
rm $NEWNAME (unless there is a backup argument after the "-i")
mv $NEWNAME file.bak (if there is one)

Ralf
-- 
GS d->? s:++>+++ a+ C++++ UL+++ UH++ P++ L++ E+++ W- N++ o-- K- w--- !O M- V-
PS+>++ PE Y+>++ PGP+ !t !5 !X !R !tv  b+++ DI+++ D?  G+ e++++ h+ r? y?



More information about the Python-list mailing list