This is a discussion on how to find out all files or folders which has space in the name, andincludes specific string recursively? within the Linux General forums, part of the Linux Forums category; suppose there are some folders and files in folder /tmp/noname.com like /tmp/noname.com/html/School Photos/help ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
suppose there are some folders and files in folder /tmp/noname.com
like /tmp/noname.com/html/School Photos/help me.html /tmp/noname.com/www bak/html/cam/pics/many thanks.html /tmp/noname.com/test/old test/god bless us.html ...... some of the files have a line including "global warming", like ... we all know global warming, blah, blah ... My shell script could not treat the spaces well, and I don't know how to handle it. Any hints would be appreciated!! |
|
|||
|
On 2008-04-24, mike-yue <needpassion@gmail.com> wrote:
> > > suppose there are some folders and files in folder /tmp/noname.com > like > /tmp/noname.com/html/School Photos/help me.html > /tmp/noname.com/www bak/html/cam/pics/many thanks.html > /tmp/noname.com/test/old test/god bless us.html > ...... > > some of the files have a line including "global warming", like > ... > we all know global warming, blah, blah > ... > > My shell script could not treat the spaces well, and I don't know how > to handle it. > Any hints would be appreciated!! find . -name '* *' -print0 | xargs -0 grep "global warming" |
|
|||
|
mike-yue writes:
> suppose there are some folders and files in folder /tmp/noname.com > like > /tmp/noname.com/html/School Photos/help me.html > /tmp/noname.com/www bak/html/cam/pics/many thanks.html > /tmp/noname.com/test/old test/god bless us.html > ...... > > some of the files have a line including "global warming", like > ... > we all know global warming, blah, blah > ... > > My shell script could not treat the spaces well, and I don't know how > to handle it. > Any hints would be appreciated!! find $PATHNAME -type f -name '* *' -print | xargs grep 'global warming hoax' -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQBIERoMx9p3GYHlUOIRApjQAJ4pLD3R9LHStJ1oE9Hj9Z icnY1tawCfVDUR JiB275GJbrYeQeeZddKiUNU= =Z2IC -----END PGP SIGNATURE----- |