Re: grep "\" ... how
Yup this works, though you can't save the output to the original file
(it blanks it). So I first copy the original to a backup, and then run
the backup through sed and overwrite the original (then delete the
copy). I can wrap all this in a batch script to fix the entire
directory.
I have a book on awk (that was another idea of what to use here) and
probably will order that camel book. (Perl is usefull for CGI also,
which is something else I want to learn.).
--- rp941372@rrpac.upr.clu.edu wrote:
> > 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.
>
> Good. So you need to change `\` to `/` in lines
> that start with
> '#include':
>
> cat file.c |sed -e '/^[ \t]*#include/ s,\\,/,g'
> >outfile.c
>
> That I think should do it. If it fails, at least
> you should be on the
> right track.
>
> (Basically it means "On every line that starts with
> optional whitespace
> followed by an include statement, substitute all
> instances of
> backslashes with slashes".)
>
> And for homework, study regular expressions (man
> grep) and sed (man
> sed). As someone said, you could also try learning
> perl. Actually, vi
> or emacs's search and replace facilty can also do
> this quite easily.
>
> Luck porting your program!
>
===
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: