Reputation: 11
I would like to copy the contents of a text file has another text file but do not crush the first 2 lines of the other file, or copy and add the 2 lines to the new file
Exemple:
user1.txt
:
Phill
Johne
Marie
Arthuro
user2.txt
:
Allow from:
Phill
Johne
Marie, Arthuro are new users from an account list, they must be copied to the authorized user file "txt2".
I tried with several solution with cat
, sed
, grep
, but I can't:
cat user1.txt | uniq > user2.txt;
I run uniq
to avoid copying duplicate names, it is good but this solution overwrites "allow from" in user2.txt
Upvotes: 0
Views: 62
Reputation: 11
this work fine :
grep -vFxf user2.txt user1.txt >> user2.txt
thank for your help
Upvotes: 0