3
3
3amunyk2017-02-11 14:30:33
linux
3amunyk, 2017-02-11 14:30:33

In file1, delete lines from file2?

As in file1 containing lines like mail: first name: last name: age, delete those lines that are contained in file2 where just mail is indicated
.
cat file2; do sed -i -e "/$a/d" file1; done

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
abcd0x00, 2017-02-11
@abcd0x00

How to delete the lines in file1 containing lines of the form mail: first name: last name: age that are contained in file2 where just mail is indicated

grep -f file2.txt -v file1.txt >output.txt

J
jcmvbkbc, 2017-02-11
@jcmvbkbc

join -v 1 -t: <(sort файл1) <(sort файл2)
the output will be lexicographically sorted.
man join
man sort

3
3amunyk, 2017-02-11
@3amunyk

swears forever for similar errors
join: /dev/fd/62:1474: no sort: 010203.:[email protected]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question