Changing back slashes to forward slashes 
Author Message
 Changing back slashes to forward slashes

| I have a question for those {sed, grep, awk, tr} wizards out there.
| I'd like to change all the occurrences in a file of a line like this:
| #include "dira\dirb\incl.h"
| to
| #include "dira/dirb/incl.h"
| but only for the lines that begin with "#include".

perl -pi~ -e 's#\\#/#g if /^#include/' file1.c file2.c file3.c ...

Pretty darn simple with Perl.  Even leaves you a backup.

Just another Perl hacker,
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |

\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/

Tue, 02 Feb 1993 05:53:18 GMT  
 [ 1 post ] 

 Relevant Pages 

1. back vs. forward slash

2. Erroneous Forward Slash in HTML Code by

3. Substituting backslash for 2 forward slashes

4. Regex Variable String ends in slash

5. problem with slash and backslash : strange behaviour with different PC

6. permission problem when running make with Perl modules (compiling slash)

7. DBIx::Password/Bundle::Slash didn't set the virutal user

8. Slashes

9. Can't locate in @INC

10. Slash pre0.3 + MySQL + Apache

11. split a path and keep the slashes?

12. Slash vs backslash in nt vs 95?


Powered by phpBB® Forum Software