Hi.
I'm embarrassed to say I can't resolve this. So, my mind has gone blank!
I've got a test file, with the following lines. Basically, I want a grep/regex to traverse the multiple lines to return the lines.
ll_=urllib.quote_plus(simplejson.dumps(b2))+"\n" pathchildcount_filep.write(ll_)
I've tried a number of attempts.. I thought something similar to the following should work. (but no luck)
pcregrep -Mi ".+urllib.quote_plus(simplejson.dumps(b2))(.+\n).+path" foo.py
The test file actually has the "\n" chars as text but the regex/grep can ignore it, to focus on getting the two lines..
In the case of the example, both lines start at the beginning of the line.
Thanks
(no laffing!!)
On 24Jun2016 10:57, bruce badouglas@gmail.com wrote:
I've got a test file, with the following lines. Basically, I want a grep/regex to traverse the multiple lines to return the lines.
ll_=urllib.quote_plus(simplejson.dumps(b2))+"\n" pathchildcount_filep.write(ll_)
I've tried a number of attempts.. I thought something similar to the following should work. (but no luck)
pcregrep -Mi ".+urllib.quote_plus(simplejson.dumps(b2))(.+\n).+path" foo.py
The test file actually has the "\n" chars as text but the regex/grep can ignore it, to focus on getting the two lines..
Had you thought about sed? Untested:
sed -n '/^ll_=urllib.quote_plus(simplejson.dumps/,/^pathchildcount_filep.write/p' foo.py
(One line, in case your mail read folds it.)
I've simplified the regexps, but I'm sure you get the idea.
Cheers, Cameron Simpson cs@zip.com.au
oh.. my bad.. sorry..
here's what I developed to solve my issue in case others need it
pcregrep -M 'urllib.quote_plus(simplejson.dumps(b2)).*\n.*path *Parse_cloud_test.py
this allows for searching for content across multiple lines (across a \n newline)
On Sun, Jun 26, 2016 at 3:17 AM, cs@zip.com.au wrote:
On 24Jun2016 10:57, bruce badouglas@gmail.com wrote:
I've got a test file, with the following lines. Basically, I want a grep/regex to traverse the multiple lines to return the lines.
ll_=urllib.quote_plus(simplejson.dumps(b2))+"\n" pathchildcount_filep.write(ll_)
I've tried a number of attempts.. I thought something similar to the following should work. (but no luck)
pcregrep -Mi ".+urllib.quote_plus(simplejson.dumps(b2))(.+\n).+path" foo.py
The test file actually has the "\n" chars as text but the regex/grep can ignore it, to focus on getting the two lines..
Had you thought about sed? Untested:
sed -n '/^ll_=urllib.quote_plus(simplejson.dumps/,/^pathchildcount_filep.write/p' foo.py
(One line, in case your mail read folds it.)
I've simplified the regexps, but I'm sure you get the idea.
Cheers, Cameron Simpson cs@zip.com.au -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://lists.fedoraproject.org/admin/lists/users@lists.fedoraproject.org Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org