On 12Sep2016 19:37, bruce <badoug...@gmail.com> wrote:
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"

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

With the URL on stdin:

 tr '?&' '\012\012' | sed -n 's/^storeId=//p'

With the URL in a variable:

 
url='http://venturacollege.bncollege.com/webapp/wcs/stores/servlet/BNCBHomePage?storeId=78236&campusId=78236&userId=-1002&catalogId=10001&ddkey=http:BNCBMultiCampusPageCmd'
 store_id=$( printf '%s\n' | tr '?&' '\012\012' | sed -n 's/^storeId=//p' )

i.e. break the URL into the right pieces, one per line. Get the appropriate line.

Cheers,
Cameron Simpson <c...@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

Reply via email to