Monday, June 10, 2013

How to grep recursively in Solaris?

In Solaris, Solaris grep will not provide recursive option -r to search a pattern recursively. But solaris provides another command called ggrep to search recursively. But ggrep location is normally not included in the PATH variable.

[vjsujay@cheetah:/home/vjsujay]$which ggrep
no ggrep in /usr/bin /bin /usr/sbin /sbin /usr/local/bin

[vjsujay@cheetah:/home/vjsujay]$ls -l /usr/sfw/bin/ggrep
-r-xr-xr-x   3 root     bin       125664 Jan 23  2005 /usr/sfw/bin/ggrep
[vjsujay@cheetah:/home/vjsujay]$

Example for recursive grep using ggrep in Solaris:

[vjsujay@cheetah:/home/vjsujay/sp]$ /usr/sfw/bin/ggrep -R 'apple' *
file.txt:apple
file3.txt:apple orange
jsk/jsk.txt:apple
[vjsujay@cheetah:/home/vjsujay/sp]$

3 comments:

BharathKumarRaju Dasararaju said...

Super boss............:)

Christopher T said...

Thanks na...

calfre search said...

Such as very good information promoting content are provided and more skills are improved after referring to that post. To get more information about Oracle Fusion HCM Technical training in Ameerpet, please Click Here