lsb_release -a; # tested on
Description: Debian GNU/Linux 10 (buster)
# output all lines that containt KEYWORD
grep KEYWORD file.txt
# output all lines that DO NOT containt KEYWORD (search inverted)
grep -v KEYWORD file.txt
# -v, --invert-match
# Invert the sense of matching, to select non-matching lines.
# subsearch, first search for "this" than in that output search for "that"
# show all lines that have this and that
output of a command | grep "this" | grep "that"
# grep multiple: show all lines that have either or that
output of a command | grep -e 'this' -e 'that'
# thus if the user wants to filter out all lines containing KEYWORD
grep -v KEYWORD file.txt > file.without.KEYWORD.txt
# if the user wants to filter out all lines that start with char x
# show all lines that start with x
grep "^[x]" file.txt | less
# hide all lines that start with x
grep -v "^[x]" file.txt | less
# search for FILENAME, and pipe result to less
find / -iname "*FILENAME*"|less
# inside less it is possible to type
/another-search-pattern
# this way is convenient to find files by filename with two search patterns
# filter out all lines of man that contain the keyword mail
man mail|grep --color mail
- only together we can create a truly free world
- plz support dwaves to keep it up & running!
- (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
- really really hate advertisement
- contribute: whenever a solution was found, blog about it for others to find!
- talk about, recommend & link to this blog and articles
- thanks to all who contribute!