On 4/18/22 16:39, Michael Barnes wrote:
I use the locate command often to find files on my machine. How can I act
on that list?
For example, I do
locate -i bozo
and get a list of all files containing bozo in the name. Now I want to copy
all those files into a new directory. I've tried various
you can iterate over the response in several ways, e.g.:
for i in $(locate -i bozo) ; do echo $i ; done
or
locate -i bozo | while read f ; do echo $f ; done
Be careful about files with whitespace in the filenames. Also, BE VERY
CAREFUL, it's possible to do a lot of damage pretty fast.
On
I use the locate command often to find files on my machine. How can I act
on that list?
For example, I do
locate -i bozo
and get a list of all files containing bozo in the name. Now I want to copy
all those files into a new directory. I've tried various combinations of
pipe to something, but no