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

Re: grep "\" ... how

--- rp941372@rrpac.upr.clu.edu wrote:
> > I need to write a script to replace '\'s with '/',
> but how can I get
> > grep to accept '\' as a regular expression (it
> assumes it to be line
> > continue character, at least from the sh prompt)?
> Come to think of it, if you're trying to _replace_
> charcacters, instead
> of just locating them, you might want to try the tr
> command:
> 	cat file |tr '\\' '/' >outfile
> This commandline feeds file into the 'tr' command,
> which here is told to
> replace backslashes (note that here too, you must
> use '\\') with
> slashes, and then sends the output to outfile. 
> Check out the man page
> for 'tr'.
> If backslashes will only appear in file paths, you
> are set.  If they
> appear in some other contents where they need to be
> kept, then look at a
> more sophisticated tool like sed.
This it true... the '\' also appears in printf's
IE: fprintf("\t hello \n");

Amateur Radio, when all else fails!


Debian Gnu Linux, Live Free or .....

Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply to: