Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
grep search in multiple dirs
Name: covina Date: February 22, 2007 at 11:22:28 Pacific OS: AIX 5.3 CPU/Ram: 512 Product: IBM
Comment:
Need help to grep for a string in each and every files in multiple folders just like the find command works find ./ -name abc.txt -print
find . -type f -name "*.txt" -print|xargs grep string
xargs is more efficient because -exec spawns a new shell each time it executes. Also, in the past -exec has overflowed the buffer if lots of files were found. Most modern *nixes won't do that now.
0
Response Number 2
Name: covina Date: February 23, 2007 at 08:00:21 Pacific
Summary: Hi! I want to know if there is any way to substitute the contextual grep (-C) function of Linux in UNIX. My problem is that I need the 10 lines preceiding my grep search in a log file? Any suggestion...
Summary: hello, may i know how can i find and change string in multiple file...i had refer some of the post here .. but found that all is about find and change string in a file only..let say i want to change a...
Summary: i need to search for *.txt in the current directory(excluding sub-directories) and need to itirate through each *.txt i.e. my requirement is to pick each *.txt in the current dir n pass it to other sc...