Sample Header Ad - 728x90

bash remove common lines from two files

3 votes
1 answer
4268 views
I have two files, (no blank lines/Spaces/Tabs) ###_/tmp/all_ aa bb cc hello SearchText.json xyz.txt ###_/tmp/required_ SearchText.json ------- and the end output I want is : (all uncommon lines from /tmp/all) aa bb cc hello xyz.txt I have tried below commands :- # comm -23 /tmp/required /tmp/all SearchText.json # comm -23 /tmp/all /tmp/required aa bb cc hello SearchText.json xyz.txt # comm -13 /tmp/all /tmp/required SearchText.json # comm -13 /tmp/required /tmp/all aa bb cc hello SearchText.json xyz.txt # grep -vf /tmp/all /tmp/required # grep -vf /tmp/required /tmp/all aa bb cc hello SearchText.json xyz.txt # comm -23 <(sort /tmp/all) <(sort /tmp/required) aa bb cc hello SearchText.json xyz.txt
Asked by Girish (133 rep)
Mar 18, 2019, 01:04 PM
Last activity: Apr 12, 2021, 05:35 AM