![]() |
Xargs: Missing quote
Hello,
I'm trying to run this program: find . -name "*.html" -type f | xargs grep -ls 'string' but it crashes with the error: xargs: Missing quote: (filename) The file name has a single quote in it (which is ridiculous but that's another topic altogether). Is there any way to get around this? Essentially, I am trying to search an entire directory and all it's files and subfolders that include a certain string all the while suppressing an errors. Thanks! |
Try:
Code:
find . -name "*.html" -type f -print -exec grep -ls 'string' {} \; |
Quote:
|
Quote:
|
Quote:
Code:
find . -name "*.html" -type f -print0 | xargs -0 grep -ls 'string' |
This worked fine on my system:
Code:
find . -name "*.html" -type f -printf '"%p"\n' | xargs grep -ls 'string'That command assumes none of your files have a double quote in them. If you do, then you'll run into similar problems as you did originally (mismatched quotes). |
| All times are GMT -5. The time now is 07:42 PM. |