Tagged Questions
2
votes
2answers
34 views
Use xargs to send requests to the same server in parallel with netcat
I am trying to devise a one-liner to send text to a simple echo server - but multiple connections in parallel. This is what I'm trying:
echo -e A,B,C,D | xargs -d, -i -P 4 echo {} | nc localhost ...
0
votes
3answers
38 views
How to call the names of directories after passing them all to xargs?
I'm using find to pass all directories to xargs, and the command on each dir by xargs needs to create a new directory for each, looking like dirname_a, so how can this be done?
ie
find . -type d ...
0
votes
1answer
32 views
Why doesn't this xargs + grep combo work properly?
I have two files, team1.txt and team2.txt
team1.txt
===========
Alex
Bob
Charlie
David
team2.txt
===========
Alex
Charlie
Benjamin
Zed
Noah
I want to output the people who are in both team1 ...
0
votes
2answers
41 views
Redirect strace to file
Am trying to trace apache2. These are the commands i'm trying to run.
ps auxw | grep sbin/apache | awk '{print"-p " $2}' | xargs strace >> trace.txt
I tried
(ps auxw | grep sbin/apache | awk ...
1
vote
3answers
217 views
Why doesn't piping grep output into xargs work with color?
I have a strange issue. My grep has colored output, and if I do something like this:
grep -lr '80' /etc/apache2/sites-available/|xargs ls
I got:
ls: cannot access ...
0
votes
3answers
76 views
How can i move files with xargs in linux
I am trying this and its not working
ls file_* |xargs mv {} temp/
Any ideas
1
vote
3answers
64 views
what is diff bentween xargs with braces and without in linux
I want to know what is the difference between this
ls | xargs rm
ls | xargs -i{} rm {}
Both are working for me
3
votes
2answers
172 views
How to use wildcards in a xargs-command?
I've got a directory with numbered files, e.g. 1_foo.txt 2_bar.asc 13_test.png, and want to move them into individual directories (e.g. 1, 2 and 13) using as simple a bash command as possible.
...
0
votes
4answers
96 views
how to do grep in the man command of linux using xargs?
I want to grep into a manual of a particular command say man grep |grep 'insensitive'. One of friends told me that It can be done using xargs but I cant seem figure out how. I want to do it using ...
1
vote
3answers
175 views
Difference between xargs /bin/ls and exec ls?
Hi this may be a very newbie question, but why doesnt the xargs /bin/ls work in this case? I thought it was supposed to be faster? Also what are those /fd/3 directories?
sh-3.2# find / -name 'GOALS*' ...
2
votes
3answers
142 views
Xargs string interpolation, not by inserting a space
I want to repeat
touch ../template/filename
where filename comes from find. I want xargs to apply the touch operation, but I dont want it to insert a space like it usually does which derives into:
...
0
votes
3answers
2k views
Using xargs with mv and mkdir command in Linux
I am attempting to create a directory using the command mkdir. However, I would like to move a subset of files into that directory. I understand I can use xargs, however my attempts have failed. For ...
1
vote
1answer
641 views
Executing lines of a file with xargs, using stdout redirection
I have a file that has lines that look like this:
"http://api.domain.com/path/to/resource?format=json" > output.xml
and I execute the following from my command line:
cat file | xargs -L 1 -I {} ...
1
vote
1answer
481 views
Using a Linux/Unix terminal to copy many files to a new location
I'm trying to use the a Linux terminal to copy many files to a new location. I tired the command:
sudo locate -i *file_I_want* | xargs cp $1 /place_I_want_everything_copied_to/
Which, gives an ...
2
votes
1answer
727 views
Create symlinks recursively for a whole tree
I am seeking for a command that would re-create a whole tree of files in a different directory. I would prefer to have all symlinks absolute. Can I do that with a find and xargs? ;-)
1
vote
2answers
133 views
Can I simulate ack by using grep with the right combination of options?
I have ack-grep installed on my local machine, and find it indispensable for quickly 'acking' through a codebase when debugging.
However, on my cheap shared hosting, there is no ack-grep. One of the ...
1
vote
1answer
194 views
Expanding globs in xargs
I have a directory like this
mkdir test
cd test
touch file{0,1}.txt otherfile{0,1}.txt stuff{0,1}.txt
I want to run some command such as ls on certain types of files in the directory and have the * ...
0
votes
2answers
440 views
find Argument list too long
I want to search in many many files for a string.
I used find /archive/* -print0 | xargs -0 grep 'robert' -sl
Is there a simple method to do it ?
3
votes
2answers
888 views
rsync N newest files in a directory
What would be the easiest way to go about rsyncing the n newest files in a directory to a remote server?
1
vote
3answers
3k 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?
4
votes
2answers
2k 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 ...
1
vote
4answers
122 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
4k 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
3answers
1k 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
...