D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] Regular expression stupidity

 

Hi everyone, can some one tell me what i am doing wrong here :-

Input string in text file (myfile.patch)

+++ linden\indra\newview\llcontroldef.cpp          2007-08-08
18:12:32.312500000 +0200

I want to fix the dos paths to unix paths

My command :-

perl -pi -w -e 's/linden\\indra\\[a-zA-Z0-9]*\\[a-zA-Z0-9.]*/linden\/indra\/%1\/%2
/g' myfile.patch

The results :-

+++ linden/indra/%1/%2          2007-08-08 18:12:32.312500000 +0200

I though %1 etc were substituted for the regex match but it just
prints %1 literaly. What am i doing wrong? I want to run this on a
whole bunch of files to fix the paths so i need to do this from the
command line or a script.

Robin

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html