Skip to main content
added another example
Source Link
Freddy
  • 26.3k
  • 1
  • 27
  • 64

With grep:

grep -vwf file matrix > matrix.new
mv matrix.new matrix
  • option -f FILE use FILE as pattern input file
  • option -w select only those lines containing matches that form whole words
  • option -v select non-matching lines

Note that file must not contain any empty lines.

Or if you create your identifier file manually with an anchor ^ to match the start of the line and a space character after each identifier to mark the end of the pattern:

printf '^%s \n' denovo{1,100,1000,100000} > file
grep -vf file matrix > matrix.new
mv matrix.new matrix

With grep:

grep -vwf file matrix > matrix.new
mv matrix.new matrix
  • option -f FILE use FILE as pattern input file
  • option -w select only those lines containing matches that form whole words
  • option -v select non-matching lines

Note that file must not contain any empty lines.

With grep:

grep -vwf file matrix > matrix.new
mv matrix.new matrix
  • option -f FILE use FILE as pattern input file
  • option -w select only those lines containing matches that form whole words
  • option -v select non-matching lines

Note that file must not contain any empty lines.

Or if you create your identifier file manually with an anchor ^ to match the start of the line and a space character after each identifier to mark the end of the pattern:

printf '^%s \n' denovo{1,100,1000,100000} > file
grep -vf file matrix > matrix.new
mv matrix.new matrix
Source Link
Freddy
  • 26.3k
  • 1
  • 27
  • 64

With grep:

grep -vwf file matrix > matrix.new
mv matrix.new matrix
  • option -f FILE use FILE as pattern input file
  • option -w select only those lines containing matches that form whole words
  • option -v select non-matching lines

Note that file must not contain any empty lines.