Hi Expert,
Kindly request for your expertise in this matter.
I have below output:
12.125.124.173,xx1.common.com
12.125.124.174,xx2.common.com
12.125.124.175,xx3.common.com
12.125.124.176,
12.125.124.177,
12.125.124.178,
12.125.124.179,xx4.common.com
12.125.124.180,xx5.common.com
12.125.124.181,xx6.common.com
12.125.124.182,xx19.common.com
12.125.124.183,xx54.common.com
12.125.124.184,
12.125.124.185,
12.125.124.193,
12.125.124.194,
12.125.124.195,
12.125.124.196,xx33.common.com
12.125.124.197,xx89.common.com
12.125.124.198,xx88.common.com
and how do I script it to just appear with:
by omitting the xxx.common.com
12.125.124.176,
12.125.124.177,
12.125.124.178,
12.125.124.184,
12.125.124.185,
12.125.124.193,
12.125.124.194,
12.125.124.195,
thank you.
ctsgnb
2
grep -v "common" yourinputfile
As you mentioned about sort,
grep -v "common" file|sort
thanks for reply.
but how do I just grep blank instead of "common"?
I would like to have this output
12.125.124.176,
12.125.124.177,
12.125.124.178,
instead of
12.125.124.173,xx1.common.com
12.125.124.174,xx2.common.com
12.125.124.175,xx3.common.com
Thank you.
if the comma is always present at the end of the line you want, use grep ',$'
what do you mean balnk, you mean the second field after IP is blank or whole line is blank ?
sed -n '/common/!p' <file name>
ctsgnb
8
If you want to keep the IP but remove the part containing "common" :
sed 's/,.*/,/' yourfile
not quite there yet,
What I wanted is to exclude all lines that include 'common' word.
Thank you,
Paul Albert
---------- Post updated at 10:52 PM ---------- Previous update was at 05:23 PM ----------
Thanks. SOLVED!