Quote:
Originally Posted by martino4262
$ grep -l "nopace" /path/test2/white/0*/f.dat | xargs -i cp '{}' /temp/
grep: No match.
|
The message says this: The shell tries to expand
/path/test2/white/0*/f.dat before passing the argument list to
grep, but there's no matching file or directory. maybe you should adapt the pattern; e.g., using p.text.
You might not like the result if the above line worked: It would copy all "f.dat" files that contain "nopace" into "/temp/".
- I think you're looking for "failure" not "nopace"
- You typically don't have "/temp", only "/tmp".
- As they all have the same name, every "f.dat" would overwrite the previous one. You'd end up with a copy of just the last matching in /temp/f.dat
- Well, it doesn't remove anything, certainly not not the parent directories :-)
You didn't tell us enough about your folders. If there are just the 4 you mention,
Code:
grep -l failure ab/cd/ef/00[1-4]/p.text | cut -d/ -f-4 | xargs rm -ri
Adapt the pattern to your situation. Before unlinking, rm will ask you for each file. When you're sure it does the right thing, you can omit the "i" option.