Sunday, 15 May 2011

batch file - Use of "repl.bat" -



batch file - Use of "repl.bat" -

am right in assuming repl.bat not work if i'm trying search & replace pattern can 3-4 lines long?

whenever seek utilize '/s', '/n', or go on pattern search onto next line, fails find pattern @ all.

e.g. searching next pattern

in range(60): try: if self.is_element_present(by.css_selector, "div[id=navigation] ul[id=mainnav] a[href='/datavalues/']"): break except: pass time.sleep(1) else: self.fail("time out")

so when try: type file.py | repl "\sfor in range\(60\)\:" "cookie" file.py.new

...to represent first line, find first line successfully.

however if add together '\n' or '\s' go on searching pattern past first line:

** type file.py | repl "\sfor in range\(60\)\:\stry" "cookie" file.py.new **

...it fails find , no changes made. i've tried different combinations of \n , \s & results same. ahead of time help!

read documentation more carefully. need m alternative able match across multiple lines.

for example, given test.txt

red + bluish

then

type test.txt | repl "red\s*\+\s*blue" "purple" m

yields

purple

batch-file replace

No comments:

Post a Comment