Rekursive Grep on Solaris or AIX Systems without GNU egrep -r funcionality
If you work regularly on a Solaris or systems which do not have the β-rβ (recursive grep) for grep, then you know what a lifesaver this command can be.
Here is one from command line fu:
find . -type f -exec awk '/linux/ { printf "%s %s: %s\n", FILENAME, NR, $0; }' {} \;
The benefit of using awk here is that you can print the line number also π
There are other versions that you can use:
find . -type f -exec grep "string here" {}\;
Some prefer with xargs:
find . -type f |xargs -n 1 grep "string here" {}\;
Related articles
- How to create static binaries (not linked, portable) of GNU find for Solaris 8,9,10 and AIX (stackoverflow.com)
- LINUX Basic Commands (dustycodes.wordpress.com)
- How to Monitor Linux Server (anhtun.wordpress.com)
- Linux hardware details. (amit-agarwal.co.in)
Related Articles:
- 2011/11/28 Linux hardware details.
- 2011/06/05 Total upload and download on any interface.
- 2011/01/31 Ranking of the most frequently used commands
- 2011/01/25 shopt causes bash completion to stop working.
- 2011/01/05 Shell Scripting
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.