[PLUG] shell scripting problem
Felix Lee
flee at aracnet.com
Fri Jun 7 07:42:43 UTC 2002
Matt Alexander <m at netpro.to>:
> I'm thinking something along these lines...
> for name in `cat namefile`;do sed s/$name,// group;done
For things like this, my approach is to turn namefile
into a sed script and then apply that script. Something
like this:
for name in `cat namefile`; do
echo "s/,$name,/,/"
echo "s/:$name,/:/"
echo "s/,$name\$//"
done > sedscript
sed -f sedscript group > newgroup
If you're feeling brave, you can write that so it doesn't
need any temporary files at all.
--
[ sometimes dogs sing ]
More information about the PLUG
mailing list