Solved

extract 1 topleveldomain type from huge domain textfile

Posted on 2013-11-25
2
141 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

626 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