Jump to content
Htich

Extragere domenii din lista cu adrese email

Recommended Posts

Posted

Un mic hint cum pot sa "salvez" domeniu de la ionCuvaca@yahoo.com , dintr-o lista ? Adica sa am doar yahoo.com...sau ce domeniu doresc.

Am vazut sapt asta un post asemator dar nu il mai gasesc , daca mi se ofera raspunsul cum sa salvez dintr-o lista doar domeniul de la email , rog un admin/moderator sa mi se stearga .

// Logic dupa ce aflu raspunsul :)

Posted (edited)

1. Solutie

Pentru a le vedea:


awk -F "@" '{print $2}' lista.txt

Pentru a le salva:


awk -F "@" '{print $2}' lista.txt > domenii.txt

2. Exemplu

Am o lista:


marian@hp:~$ cat lista.txt
ion@hotmail.com
george@usinternet.com
vasile@yahoo.com

Vreau sa vad doar domeniile:


marian@hp:~$ awk -F "@" '{print $2}' lista.txt
hotmail.com
usinternet.com
yahoo.com

Vreau sa salvez domeniile in fisierul domenii.txt:


marian@hp:~$ awk -F "@" '{print $2}' lista.txt > domenii.txt

Au fost salvate:


marian@hp:~$ cat domenii.txt
hotmail.com
usinternet.com
yahoo.com

Edited by aelius
Posted
cum zice Tex dar mai adaugam ceva...

awk -F "@" '{print $2}' | sort | unique > lista.txt

Ai un pipe acolo in loc de argument


awk -F "@" '{print $2}' | sort --unique > lista.txt

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...