utility in Unix-like operating systems for passing large numbers of arguments to programs that can only take a small number of arguments

learn more… | top users | synonyms

2
votes
3answers
2k views

find . -exec grep -l 'string' {} \; -print 2>/dev/null

it lists all files in "." that contain the string "string" but don't show dirs with permission denied. What would it be the equivalent of that but squeezing xargs in between?
1
vote
4answers
169 views

printing matching lines when greping all files in a directory

I'm searching within Java files for some occurrence of a phrase: find . -name '*.java' | xargs grep -l 'string' How do I change this command to print to the shell all of the lines which contain a ...
3
votes
3answers
6k views

How do I use find to copy all found files to a new name in their same directories?

I've got a simple command that does almost what I want. The following will locate all files with a suffix of '_compressed.swf' and copy each into its same directory with a '.bak2' appended: find ...
0
votes
4answers
375 views

How do I execute find with GNU xargs to traverse a set of directories?

$ echo {a,b,c}.h d e.h |xargs -IA find A -name '*.h' find: `a.h b.h c.h d e.h': No such file or directory $ echo -e a.h\\nb.h c.h d e.h |xargs -IA find A -name '*.h' a.h find: `b.h c.h d e.h': No such ...
0
votes
3answers
3k views

Recursive move files of specific type to a specific path

In ~/my/path, I want to move all files that contain string "(J)" and have file type of ".foo" to ~/my/path/j I'm trying: [me ~/my/path]$ find -type f -name "*(J)*.foo" -print0 | xargs mv -0 j/ No ...
1
vote
3answers
2k views

xargs vs backtick

More silly questions from the Linux n00b. =D I'm curious about the performance ramifications of using xargs vs. backticks. For example, what's the different between: find ./ -name foo* | xargs rm ...
8
votes
4answers
9k views

find: -exec vs xargs (aka Why does “find | xargs basename” break?)

I was trying to find all files of a certain type spread out in subdirectories, and for my purposes I only needed the filename. I tried stripping out the path component via basename, but it did't work ...