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

1
vote
1answer
743 views

How to use xargs/find to execute on per file basis

I have some php scrits in a subfolder and want to run some of them (found by a regular expression) via command line. Here is what I have so far: find . -name email[^T]*\.php -print0 | xargs -0 -t ...
4
votes
3answers
12k views

ls -rt (How to list just THE LAST file? e.g. for: | xargs gnome-open)

e.g. directory containing jpeg files: how to easily open just the most recent jpeg in the current directory?
5
votes
2answers
4k views

Grep exits abnormally with code 123 when running rgrep on emacs

Greetings fellow Emacsers I'm running GNU Emacs 23.1.1 on "Ubuntu 10.04.1 LTS" and any search I perform using the built-in M-x rgrep on the standard Linux kernel source code (vanilla) ends ...
6
votes
3answers
12k views

Why does this not work? “ls *.txt | xargs cat > all.txt” (all files into single txt document)

Why does this not work? ls *.txt | xargs cat > all.txt (I want to join the contents of all text files into a single 'all.txt' file.) find with -exec should also work, but I would really like to ...
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 ...