Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

extract 1 topleveldomain type from huge domain textfile

Posted on 2013-11-25
2
Medium Priority
?
146 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 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
I have written articles previously comparing SARDU and YUMI.  I also included a couple of lines about Easy2boot (easy2boot.com).  I have now been using, and enjoying easy2boot as my sole multiboot utility for some years and realize that it deserves …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

885 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