Good points. I wonder if it wouldn't be best to do it all in awk. Saves CPU cycles and complexity, IMHO.Cheers,Boris.On Tue, Sep 13, 2016 at 12:26 PM, Gordon Messmer <gordon.messmer@gmail.com> wrote:On 09/12/2016 04:37 PM, bruce wrote:
awk -F': ' '{print $2}' | tail -1 | sed 's/.*storeId=\(.*\).&/\1/'
You've got good answers, especially Cameron's. It had one error, though. If the URL is in a variable, it needs to be an argument to printf:
url='http://venturacollege.bncollege.com/webapp/wcs/stores/ 'servlet/BNCBHomePage?storeId=7 8236&campusId=78236&userId=-10 02&catalogId=10001&ddkey=http: BNCBMultiCampusPageCmd
store_id=$( printf '%s\n' | tr '?&' '\012\012' | sed -n 's/^storeId=//p' )
The reason I like Cameron's advice in particular is that it doesn't use ".*". In this case, performance isn't measurably bad, but using ".*" can eat a lot of CPU cycles.
https://blog.mariusschulz.com/2014/06/03/why-using-in-regula r-expressions-is-almost-never- what-you-actually-want
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://lists.fedoraproject.org/admin/lists/users@lists.fedo raproject.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
--
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