Re: pcregrep question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24Jun2016 10:57, bruce <badouglas@xxxxxxxxx> 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@xxxxxxxxxx>
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://lists.fedoraproject.org/admin/lists/users@xxxxxxxxxxxxxxxxxxxxxxx
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



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux