Solved

extract 1 topleveldomain type from huge domain textfile

Posted on 2013-11-25
2
139 Views
Last Modified: 2013-11-26
hi

i have a txt file with a huge domainlist (serveral gb) - how can I extract the domains for a specific toplevel domain, eg all .org domains, to another txt file?

file is like this:

blabl.com
test.org
bleble.com
test2.net

etc.

thanks!
0
Comment
Question by:netslt
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 39674279
grep ".org *$" inputfile.txt > anotherfile.txt

(only spaces or newline may follow the domain name on its line in the input file).

If there's other stuff following the domain name on a line  you can use "awk":

awk '{E=split($1,A,"."); if(A[E]=="com") print $1}' inputfile.txt > anotherfile.txt
0
 

Author Closing Comment

by:netslt
ID: 39678627
Thanks!
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question