Start Free Trial
Come for the solution, stay for everything else.
Start Free Trial
Linux command 'comm' and whitespace
I am seeing every single line show up on my comm comparison, because one file uses spaces, while the other uses tabs
Is there any way to get comm to print out the differences that exclude white space ?
8/22/2022 - Mon
Alas, "comm" does not have such an option.
"diff" on the other hand, does have options for this, "-w" to ignore all whitespace and "-b" to ignore changes in the number of whitespaces.
diff -w a.conf b.conf
If you don't want to see the additional info which "diff" provides but only the changes:
diff -w a.conf b.conf | grep -E "^<|^>"
If you don't want to see the additional info which "diff" provides and finally filter out the "<" and ">" characters:
diff -w a.conf b.conf | grep "^<" | cut -f2- -d" "
(differences in file 1)
diff -w a.conf b.conf | grep "^>" | cut -f2- -d" "
(differences in file 2)
diff -w a.conf b.conf | grep -E "^<|^>" | cut -f2- -d" "
ASKER CERTIFIED SOLUTION
Log in or sign up to see answer
Become an EE member today
7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
Plans and Pricing
Certified Expert Program
© 1996-2022 Experts Exchange, LLC. All rights reserved. Covered by US Patent