2

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
2
  • no no space before // Commented Aug 27, 2015 at 17:34
  • i want the whole http:///............... link Commented Aug 27, 2015 at 17:35

2 Answers 2

1

You can use grep -E:

grep -i -oE 'https?://soundcloud\.com[^[:blank:]]*'
Sign up to request clarification or add additional context in comments.

5 Comments

bro what if i want only get the text starting with soundcloud.com .......... i mean i dont want print the other sites links , how can we change the grep ???
Try this one: sed '/:\/\/soundcloud\.com[^[:blank:]]*search/d'
working now :) you are really god of bash . thanks a lot man :*
more 5 lines are gone away
0

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/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.