Quantcast
Channel: linuxadmin: Expanding Linux SysAdmin knowledge
Viewing all articles
Browse latest Browse all 17770

Extracting ONLY domain names from a text file

$
0
0

Hello,

I have a text file with urls like below

udp://tracker.1337x.org:80/announce udp://tracker.ccc.de:80/announce http://cpleft.com:2710/announce http://tracker.novalayer.org:6969/announce udp://tracker.novalayer.org:6969/announce http://exodus.desync.com/announce http://exodus.desync.com:6969/announce 

I would like to extract only domain names so the output would be like

1337x.org ccc.de cpleft.com novalayer.org 

How can i achieve this using grep,sed or any other means.The closest i have come is using this :
sed -r 's/.(dm[.].[/ ])./\1/g' file

but this captures subdomains which i donot want

submitted by ericnyamu
[link][15 comments]

Viewing all articles
Browse latest Browse all 17770

Trending Articles