Re: bash/regex question..

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

 





On 13/09/2016 01:37, bruce wrote:
Hey.

Simple question.

Got a basic string..
http://venturacollege.bncollege.com/webapp/wcs/stores/servlet/BNCBHomePage?storeId=78236&campusId=78236&userId=-1002&catalogId=10001&ddkey=http:BNCBMultiCampusPageCmd

trying to get the internal sub-string "78236"

If Python is available you can do:

s = 'http://venturacollege.bncollege.com/webapp/wcs/stores/servlet/BNCBHomePage?storeId=78236&campusId=78236&userId=-1002&catalogId=10001&ddkey=http:BNCBMultiCampusPageCmd'

print(s.split('storeId=')[1].split('&campus')[0])

To do it directly in Bash, assuming your string is $TRING:

python -c "print('$STRING'.split('storeId=')[1].split('&campusId')[0])"

Lorenzo.


I can remove the beginning portion, but can't figureout the rest of the
regex to remove the subsequent chars..

awk -F': ' '{print $2}' | tail -1 |  sed 's/.*storeId=\(.*\).&/\1/'

Any help/pointers/thoughts..

thanks



--
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

--
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