Shell script to remove some content in a file

How can I remove all data that contain domain e.g zzgh@something.com, sdd@something.com.my and gg@something.my in one file? so that i only have data without the domain in the file.

Here is the file structure "test.out"

more test.out
   1 zzztop@b.com
   1 zzzulll
   1 zzzullll@s.com.my
   1 zzzuri@b.com
   1 zzzurita@b.my
   1 zzzx
   1 zzzxxx92
   1 zzzxxx@b.com
   1 zzzxy85@s.com
   1 zzzz
   1 zzzz1861@b.com
   1 zzzz23@b.com.my
   1 zzzz5879
   1 zzzz888
   1 zzzz@s.my
   1 zzzzdaud
   1 zzzzin
   1 zzzzz
   1 zzzzz@b.com
   1 zzzzz@s.com
   1 zzzzznndr@b.com
   1 zzzzzz@b.com

output should be like this,

zzzulll
zzzx
zzzxxx92
zzzz
zzzz5879
zzzz888
zzzzdaud
zzzzin
zzzzz

One way would be..

awk '!/@/ {print $2}' inputfile > outfile
1 Like

Dude michaelrozar17,

thank you very much. it works 100%, may i know where can i get some note or guide to read on how to start creating shell script like you do?

One way you can start is learning regular expressions.

Here is another way of solving your problem using 'sed':

sed '/@/d' Input_File
1 Like

thx both works just fine.