Site Cloner PHP Script
Bargain Hunter PHP Script
Job Hunter PHP Script
Site Login and Access Control PHP Script

Linux Piping Output With Grep

Using the pipe operator ‘|’, you can send data from program to another. This example will show how to search for all files with ‘test’ in the name. It returns the names latest, test2.txt and test3.txt.

Search the current directory for files with the string ‘test’

root@vps [~]# ls | grep test
latest
test2.txt
test3.txt
root@vps [~]#


Searching A Single File for a String

root@vps [~]# grep "kent" newfile.txt
My name is kent.
root@vps [~]#


Searching All Files for Strings

root@vps [~]# grep -r "kent" .
./.bash_history:ls | grep kent
./.bash_history:grep kent newfile.txt
./.bash_history:grep kent ls
./.bash_history:grep -r kent
./.bash_history:grep -r "kent"
./newfile.txt:My name is kent.
root@vps [~]#