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

Re: grep "\" ... how



I this case the '\'s that appear in #include statements are the ONLY
ones that need to be changed, so I can look for #include.

--- rp941372@rrpac.upr.clu.edu wrote:
> > > 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");
> 
> Ok... You're going to have to do some surgery with
> sed scripts, and if
> that fails, do it by hand...
> 
> sed basically is a batch editor.  You give on the
> command line a
> sequence of editing commands (or tell it to read
> them from a file), and
> it applies them automatically to each line on its
> standard input.
> 
> What you need to do is determine if the two kinds of
> backslashes, the
> ones needing to be changed and the ones that don't,
> appear in disjoint
> contexts.  For example, do you only have backlash
> escape sequences
> inside printf statements, or do they occur in string
> literals elsewhere
> in your code?  Do any literal pathnames appear
> inside printf statements?
> 
> If this above is true, you could write a script that
> changed the
> backslashes into slashes only outside printf
> statements, or something
> similar.   However, the viability of this kind of
> approach depends on
> your code.
> 

===
Amateur Radio, when all else fails!

http://www.qsl.net/wa2mze

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


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


Reply to: