grep command
Shell
grep 'word' filename
fgrep 'word-to-search' file.txt
grep 'word' file1 file2 file3
grep 'string1 string2' filename
cat otherfile | grep 'something'
command | grep 'something'
command option1 | grep 'data'
grep --color 'data' fileName
grep [-options] pattern filename
fgrep [-options] words file# EXAMPLE 1: look for any files (with names ending in ".c++") for the text "::MethodA("
grep "::MethodA(" *.c++
# EXAMPLE 2: display only the matching file names (not the row too) of the matches
grep -l "MethodA(" *.c++
# SYNTAX
# grep [optional-filters] "<your-string-to-search>" <files-to-search>
# OPTIONAL-FILTERS
# +--------+----------------------------------------------------------------------------+
# | OPTION | DESCRIPTION |
# +--------+----------------------------------------------------------------------------+
# | -e | pattern |
# | -i | Ignore uppercase vs. lowercase. |
# | -v | Invert match. |
# | -c | Output count of matching lines only. |
# | -l | Output matching files only. |
# | -n | Precede each matching line with a line number. |
# | -b | A historical curiosity: precede each matching line with a block number. |
# | -h | Output matching lines without preceding them by file names. |
# | -s | Suppress error messages about nonexistent or unreadable files. |
# | -x | |
# | -f | file: Take regexes from a file. |
# | -o | Output the matched parts of a matching line. |
# +--------+----------------------------------------------------------------------------+
Also in Shell:
- Title
- Creating an environment from an environment.yml file
- Category
- Shell
- Title
- change user linuxcommand ch
- Category
- Shell
- Title
- install emotion
- Category
- Shell
- Title
- sh declare variable
- Category
- Shell
- Title
- adding remote origin git
- Category
- Shell
- Title
- choco installation
- Category
- Shell
- Title
- como agregar angular material al proyecto
- Category
- Shell
- Title
- jscore
- Category
- Shell
- Title
- install zsh debian
- Category
- Shell
- Title
- remove .svn recursively linux
- Category
- Shell
- Title
- how to install cab file in ubuntu
- Category
- Shell
- Title
- how to install react spring
- Category
- Shell
- Title
- copie fichier de server vers linux
- Category
- Shell
- Title
- linux command print only odd columns
- Category
- Shell
- Title
- linux install ping
- Category
- Shell
- Title
- install flask
- Category
- Shell
- Title
- gnome-shell turn off
- Category
- Shell
- Title
- install dateutil
- Category
- Shell
- Title
- search for files in linux terminal
- Category
- Shell
- Title
- gzip folder with tar
- Category
- Shell
- Title
- git merge branch
- Category
- Shell
- Title
- install ext-soap
- Category
- Shell
- Title
- updating git on mac
- Category
- Shell
- Title
- linux find file containing text
- Category
- Shell
- Title
- remove home icon ubuntu
- Category
- Shell
- Title
- use nvm to install latest node
- Category
- Shell
- Title
- installing caddy server in ubuntu 18
- Category
- Shell
- Title
- count occurrences of word in file linux
- Category
- Shell
- Title
- git grep across all branches
- Category
- Shell
- Title
- why all git pull create merge commit
- Category
- Shell
- Title
- angular add service worker
- Category
- Shell
- Title
- mysql backup dump docker file
- Category
- Shell
- Title
- install vscode ubuntu command line
- Category
- Shell
- Title
- pip command not found macos
- Category
- Shell
- Title
- shell count number of lines
- Category
- Shell
- Title
- pipe + exec duplicate stdout linux
- Category
- Shell
- Title
- mongodb shell query last document
- Category
- Shell
- Title
- npm install express-handlebars
- Category
- Shell
- Title
- install node in nvm
- Category
- Shell
- Title
- numpy uninstall anaconda
- Category
- Shell
- Title
- docker to sudoers
- Category
- Shell
- Title
- markdown with dimensions image github
- Category
- Shell
- Title
- install jake
- Category
- Shell
- Title
- install docker
- Category
- Shell
- Title
- join linux to ad domain
- Category
- Shell
- Title
- install pybind ubuntu
- Category
- Shell
- Title
- linux replace string in all files
- Category
- Shell
- Title
- material-ui
- Category
- Shell
- Title
- linux command for file size
- Category
- Shell
- Title
- rename remote branch in git
- Category
- Shell
- Title
- git clean remote branches
- Category
- Shell
- Title
- chown
- Category
- Shell
- Title
- split large file into smaller files
- Category
- Shell
- Title
- git delete tag name
- Category
- Shell
- Title
- how to unadd gitr file
- Category
- Shell
- Title
- how to check upstream git
- Category
- Shell
- Title
- git rebase vs merge
- Category
- Shell
- Title
- how to kill a process in linux
- Category
- Shell
- Title
- install x centos 7
- Category
- Shell
- Title
- linux command to list directory size
- Category
- Shell
- Title
- how to rsync linux
- Category
- Shell
- Title
- bash find file with text
- Category
- Shell
- Title
- find text in linux file
- Category
- Shell
- Title
- how to open emulator in vs code
- Category
- Shell
- Title
- how to remove commit in git extension
- Category
- Shell
- Title
- git init
- Category
- Shell
- Title
- improve ubuntu 16.04 performance
- Category
- Shell
- Title
- edit default port for linux server
- Category
- Shell
- Title
- GVfs metadata is not supported. Fallback to TeplMetadataManager.
- Category
- Shell
- Title
- git cancel last commit
- Category
- Shell
- Title
- apt remove ppa
- Category
- Shell
- Title
- git remote push
- Category
- Shell
- Title
- git files changed between two commits
- Category
- Shell
- Title
- how to make a .sh file executable
- Category
- Shell
- Title
- linux query port use by pid
- Category
- Shell
- Title
- git push all branches
- Category
- Shell
- Title
- package 'mana-toolkit' has no installation candidate
- Category
- Shell
- Title
- gatsby image plugin
- Category
- Shell
- Title
- randomly choose n rows from a file linux
- Category
- Shell
- Title
- xbox 360 wireless adapter linux
- Category
- Shell
- Title
- How do I get a complete list of all table names in all databases in Hive?
- Category
- Shell
- Title
- npm install dev dependencies
- Category
- Shell
- Title
- how to start a web server linux
- Category
- Shell
- Title
- apache .htaccess Option ubuntu
- Category
- Shell
- Title
- how to launch a project from gitlab to intellij
- Category
- Shell
- Title
- Shell query displays all citizens with an age greater than or equal to 21
- Category
- Shell
- Title
- timedatectl
- Category
- Shell
- Title
- pyaudio python 3.7
- Category
- Shell
- Title
- haproxy in centos 7
- Category
- Shell
- Title
- FATAL module ucvideo not found
- Category
- Shell
- Title
- screen recorder linux
- Category
- Shell
- Title
- Error while finding module specification for 'virtualenvwrapper.hook_loader' - ubuntu 20
- Category
- Shell
- Title
- git create tag and push
- Category
- Shell
- Title
- git pull a new branch froma remote repo
- Category
- Shell
- Title
- stop elasticsearch node
- Category
- Shell
- Title
- rtl8821ce driver linux
- Category
- Shell
- Title
- how to uninstall react native cli globally
- Category
- Shell
- Title
- force pull github
- Category
- Shell
- Title
- how to delete a non empty directory in linux
- Category
- Shell
- Title
- task manager ubuntu
- Category
- Shell