Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: Shell scripting
- To: <tlug@example.com>
- Subject: Re: Shell scripting
- From: Sven Simon <sven@example.com>
- Date: Sat, 26 May 2001 04:38:46 -0500 (CDT)
- Content-Type: TEXT/PLAIN; charset=US-ASCII
- In-Reply-To: <Pine.LNX.4.33.0105260402360.20365-100000@example.com>
- Reply-To: tlug@example.com
- Resent-From: tlug@example.com
- Resent-Message-ID: <3c0NNC.A.HrG.pm3D7@example.com>
- Resent-Sender: tlug-request@example.com
Problem solved! Just found out we can use any other character for sed instead of forward slashes, so using '@' was doing the job: for i in `head $1`; do sed -e s@'$i'@'#$i'@ $2 > newfile done On Sat, 26 May 2001, Sven Simon wrote: > 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 > > ----------------------------------------------------------------------- > Next Technical Meeting: Sat, May 12 13:30- > Next Nomikai Meeting: Fri, June (TBA) 19:30- Tengu Tokyo Eki Mae > ----------------------------------------------------------------------- > more info: http://www.tlug.gr.jp Sponsor: Global Online Japan > >
- References:
- Shell scripting
- From: Sven Simon <sven@example.com>
Home | Main Index | Thread Index
- Prev by Date: Shell scripting
- Next by Date: Re: Linux drivers for Fujitsu TFT monitors
- Prev by thread: Shell scripting
- Next by thread: Logitech Cordless mouse/keyboard
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links