Reputation: 307
I want grep only the text after every http: line and write it to a file. I have the current output from the output stream
References
1. https://soundcloud.com/sc-opensearch.xml
2. https://m.soundcloud.com/search/sounds?q=L AME IMMORTELLE
3. https://soundcloud.com/
4. http://www.enable-javascript.com/
5. https://soundcloud.com/search
6. https://soundcloud.com/search/sounds
7. https://soundcloud.com/search/sets
8. https://soundcloud.com/search/people
9. https://soundcloud.com/search/groups
10. https://soundcloud.com/thomas-rainer/l-ame-immortelle-banish
11. https://soundcloud.com/outtamyndxmetal-llc/lame-immortelle-the-heart
12. https://soundcloud.com/cyberdelic-mind/l-me-immortelle-dark-mix-i
13. https://soundcloud.com/sawthinzarhtaik/dort-drauben
14. https://soundcloud.com/lagrima-negra/lagrima-tears-in-the-rain
15. https://soundcloud.com/bathony/in-strict-confidence-zauberschlos-lame-immortelle-version
16. https://soundcloud.com/jubej-thos/sirius-5-jahre-lame-immortelle
17. https://soundcloud.com/virul3nt/lamme-immortelle-sag-mir-wann-shiv-r-remix
18. https://soundcloud.com/outtamyndxmetal-llc/lame-immortelle-no-goodbye
19. https://soundcloud.com/usefulrage/das-ich-dem-ich-den-traum
20. http://help.soundcloud.com/customer/portal/articles/552882-the-site-won-t-load-for-me-all-i-see-is-the-soundcloud-logo-what-can-i-do-
21. http://google.com/chrome
22. http://firefox.com/
23. http://apple.com/safari
24. http://windows.microsoft.com/ie
25. http://help.soundcloud.com/
and my code currently which is not greping is below
lynx --dump -listonly https://soundcloud.com/search/sounds?q=L%20AME%20IMMORTELLE | \
tr "\t\r\n'" ' "' | \
grep -i -o 'http......HERE I NEED THE GREP STUFF' | \
sed -e 's/^.*"\([^"]\+\)".*$/\1/g' \ >k.txt
Upvotes: 2
Views: 188
Reputation: 785058
You can use grep -E
:
grep -i -oE 'https?://soundcloud\.com[^[:blank:]]*'
Upvotes: 1
Reputation: 307
It worked with
lynx --dump -listonly https://soundcloud.com/search/sounds?q=L%20AME%20IMMORTELLE | \
tr "\t\r\n'" ' "' | \
grep -i -oE 'https?://[^[:blank:]]+' | \
sed -e 's/^.*"\([^"]\+\)".*$/\1/g' \
>k.txt
i got the appropriate output
https://soundcloud.com/sc-opensearch.xml
https://m.soundcloud.com/search/sounds?q=L
https://soundcloud.com/
http://www.enable-javascript.com/
https://soundcloud.com/search
https://soundcloud.com/search/sounds
https://soundcloud.com/search/sets
https://soundcloud.com/search/people
https://soundcloud.com/search/groups
https://soundcloud.com/thomas-rainer/l-ame-immortelle-banish
https://soundcloud.com/outtamyndxmetal-llc/lame-immortelle-the-heart
https://soundcloud.com/cyberdelic-mind/l-me-immortelle-dark-mix-i
https://soundcloud.com/sawthinzarhtaik/dort-drauben
https://soundcloud.com/lagrima-negra/lagrima-tears-in-the-rain
https://soundcloud.com/bathony/in-strict-confidence-zauberschlos-lame-immortelle-version
https://soundcloud.com/jubej-thos/sirius-5-jahre-lame-immortelle
https://soundcloud.com/virul3nt/lamme-immortelle-sag-mir-wann-shiv-r-remix
https://soundcloud.com/outtamyndxmetal-llc/lame-immortelle-no-goodbye
https://soundcloud.com/usefulrage/das-ich-dem-ich-den-traum
http://help.soundcloud.com/customer/portal/articles/552882-the-site-won-t-load-for-me-all-i-see-is-the-soundcloud-logo-what-can-i-do-
http://google.com/chrome
http://firefox.com/
http://apple.com/safari
http://windows.microsoft.com/ie
http://help.soundcloud.com/
Upvotes: 0