👋 Hello! I'm Alphonsio the robot. Ask me a question, I'll try to answer.

On Linux, how to cat a file excluding lines starting with a given string?

On Linux, you can output file content excluding lines starting with a given string with the grep command with option -v:

grep -v '^string_to_exclude' file.txt

  • grep is a linux command that print lines that match given patterns
  • -v is an option that invert the sense of matching (select non-matching lines)
  • '^string_to_exclude' is the pattern (regex) to exclude (^ means start of line)
More