[Sussex] Any SED and AWK experts out there?

John Crowhurst fyremoon at fyremoon.net
Mon Apr 21 23:25:01 UTC 2003


> for i in file1 file2 file3;
> do
> sed -f sedfile $i > tmp.$i
> mv -f tmp.$i $i;
> done

You can use wildcards btw, so if you were converting asp files to php
files, you could use this instead:

for i in *.asp;
do
sed -f sedfile $i > tmp.$i;
mv -f tmp.$i `ls $i |awk -F. {'print $1 ".php"'}`;
done

The awk will cut the .asp off the file, and replace it with .php

Its probably very sloppy code, and I would have preferred to have done the
whole thing in perl :P

-- 
John







More information about the Sussex mailing list