[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
wouldn't something like this be easier? 's|\\|/|g' or do you actually want to keep some backslashes? Failing that, try putting brackets in so you have ([a-zA-Z0-9]*) and use \1 or $1 to match. %1 didn't seem to do anything. s/linden\\indra\\([a-zA-Z0-9]*)\\([a-zA-Z0-9]*)/linden\/indra\/$1\/$2/g obviously it depends on what you're doing, but this will only fix paths with 3 slashes in it, which doesn't seem very handy to me. On 10/22/07, Robin Cornelius <robin.cornelius@xxxxxxxxx> wrote: > 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 > -- 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