I want to extract a substring from a shell var. This is an example:
user@ubuntu:~$ var=$(curl -s 'https://www.youtube.com/')
user@ubuntu:~$ echo $var|grep -ob GetBrowse_rid
user@ubuntu:~$ 50000:GetBrowse_rid
user@ubuntu:~$ echo $var|grep -ob what_to_watch
user@ubuntu:~$ 55555:what_to_watch
user@ubuntu:~$ echo ${var:50000:55555}
I want to extract the text beetwen "GetBrowse_rid" and "what_to_watch", but for some reason my code not works
Aucun commentaire:
Enregistrer un commentaire