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)?
-- stuff about tr and sed --
>>
>> 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");
At this point, it might be worth your time to learn a little perl. I
know that sed and awk are rather powerful, too, but if you're porting a
program, you must be reasonably proficient at programming.
you will find a little time learning perl's regular expressions rather
useful later on, too.
-Michael
I (and many others) can give you a little help with a perl script (less
than 10 lines) that would correctly modify 99% of your backslashes.
Michael Stenner Office Phone: 919-660-2513
Duke University, Dept. of Physics mstenner@phy.duke.edu
Box 90305, Durham N.C. 27708-0305
Reply to: