How do I pull this information out of this file? sed? grep?

F

Fleximous

Guest
Hello,

I hope someone can help..

If I have a file with say the following content:

cat test
fjnjsdnfjnsdjfURLHERE
lmdslfmdsfURLHERE
kmkmkdmfkkmk4m5k456mk45URLHERE
wewew

What would I need to do to just search throught this file and pull out all the URLs?

So the end result I would just want to output

URLHERE
URLHERE
URLHERE

I couldnt post actual URLs as I'm too new to the site. But imagine the URL stars with the usual h t t p : / /

Many thanks,
 


OP
W

WeAreGeek

Guest
Try this:

Code:
sed 's/http/\^http/g' [B]YOURFILENAME[/B] | tr -s "^" "\n" | grep http| sed 's/\ .*//g'
 
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com

Staff online

Members online


Top