Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Shell scripting



I have a file X which lists filenames in the dir tree such as /etc/hosts
or whatever and I have a file Y including a subset of the names listed in
file X.

Now, what I'd like to do is comment out all those lines in file X which
show names included in file Y. I've tried to use sed with no success:
for i in `cat $1`; do
sed -e s/"$i"/"#$i"/ $2
done

with $1 being file X and $2 being file Y

I believe the problem is because of the forward slashes in the filenames
Is there a way to make this work, could I use anything else than sed?

SVEN


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links