1
rated 0 times
[
1]
[
0]
/ answers: 1 / hits: 1588
/ 2 Years ago, mon, january 10, 2022, 9:38:27
For a simple example say I have list file which has the following contents
cat dog pig
dog hat
cat
clap sing
king
ca
cat hog
plate
plate
one two three
cat
I then have a 'pattern' file. With the below content
cat
dog
What I would like to happen is a new file is created from the list file but all lines that begin with cat or dog I not copied over.
I have seen a few examples how this can work e.g.
sed '/pattern to match/d' ./infile > ./newfile
From what I have gathered sed can't handle a 'pattern input file'. Is that a similar program to sed that could achieve what I would like to do? If not could a make a program in python program that reads each line from the 'pattern' file and run the sed command against th list file e.g. multiple passes with seds
More From » sed