Questions tagged [xargs]

Execute a command, passing constructed argument list(s). The arguments are typically a long list of filenames (generated by ls or find) that are passed to xargs via a pipe.

Execute a command, passing constructed argument list(s). The arguments are typically a long list of filenames (generated by ls or find) that are passed to xargs via a pipe.

manpage

45 questions
0
votes
2 answers

How to git add list of files from git diff

I accidentally added a bunch of cache files into the repo. I've now removed them and now want to commit the change to the repo. So I tried to do the following, but git doesn't seem to like it: git diff --name-only | grep '/cache/' | xargs git…
denormalizer
  • 471
  • 2
  • 5
  • 15
0
votes
6 answers

How to recursively search and replace from command line on unix/linux system

So I want to change several files at one with one command. This is what I have so far: find -regex ".*\.ext$" | xargs grep -l searchText 2> /dev/null | xargs -i sed 's/searchText/replaceText/' > {}.new What it does: I find files with extension ext,…
Keith Bentrup
  • 699
  • 3
  • 8
  • 19
0
votes
2 answers

xargs remove file name containing $

I am using xargs to remove files from remote server. xargs -a /var/log/del.log -i -exec ssh root@abc.com 'rm -rf "{}"' del.log contains path of the files which are deleted on local server and I want to delete them on remote server. Every thing…
0
votes
3 answers

join xargs' output by newlines

I want to join output of the xargs output by new lines. I do this: find . -name '*.txt' | xargs -n 1 iconv -f UTF-16 | ...other-commands... I take one file at a time and convert it to UTF-8 (the system locale). All of the *.txt are one-liners…
Paul Kole
  • 3
  • 2
0
votes
1 answer

how to wrap the command1 return strings with single/double quotation marks (\'or\") to feed to the next command2?

For example, I want to use mplayer to play the music of several dirs, type like this in bash: $find './l_music/La Scala Concert 03 03 03' './l_music/Echoes The Einaudi Collection' './l_music/Ludovico Einaudi - The Royal Albert Hall Concert [2 CD]…
0
votes
2 answers

Is the svn nightly commit script built to capture all possible scenarios?

I have a nightly svn commit script that should take into account all possible scenarios and commit new things to our svn repository. Basically I am running the following steps: svn status [path] to add any new files svn status [path] to delete any…
Geo
  • 3,061
  • 11
  • 41
  • 52
0
votes
1 answer

Reverse and modify copy file to all subfolders command, xargs

i found this online it copy file to every sub folder on the current dir for full tree depth find -maxdepth 1 -type d -print0 | xargs -0 -n1 cp -v .htaccess now would be nice if it could ask if the file already exist or at least overwrite if file…
JohnA
  • 101
0
votes
2 answers

Running expand on a set of files

I'm trying to run the expand shell command on all files found by a find command. I've tried -exec and xargs but both failed. Can anyone explain me why? I'm on a mac for the record. find . -name "*.php" -exec expand -t 4 {} > {} \; This just creates…
ChrisR
  • 262
  • 3
  • 13
0
votes
2 answers

tar too slow when file doesn't exist!

I have a gigantic list of files on a text files. This list is passed to tar, like this: cat list.txt | xargs tar rvf archive.tar --ignore-failed-read The problem is that some files that are on the list don't exist anymore. So tar keeps saying…
gmuller
  • 53
  • 1
  • 9
0
votes
1 answer

Backup to Tape using tar: How to add file details (time, date, size) to a TAR log?

What is the best way to make my tar log more informative? Cat'ing the log shows what was backed up, but tells nothing about the files last update or size. Eg: tar cvf /dev/st0 foo* > backup.log cat backup.log foo1 foo2 ... I changed it to tar cvf…
rodfaria
  • 1
  • 1
0
votes
0 answers

Parallel bruteforce with xargs

I am working on a bruteforce script using xargs in parallel. I have it working using GNU parallel but cant get it to work right with xargs. So far I have cat $wordlist | xargs -n 1 -P 32 -I {} curl -s -o /dev/null -w '%{http_code} {}\n' --socks5…
Puffy
  • 1
0
votes
1 answer

Failing string replacement in xargs command

I am trying to automatically create symlinks to directories and to replace a certain text string (foo) of the original name in the link name (bar). The name of the target directories may contain spaces (e.g. "foo with whitespace"). This is a minimal…
0
votes
1 answer

What is the maximum value acceptable for xargs -P argument?

In this answer they mention 10 I did man xargs and couldn't find what's the maximum limit. Is it possible to send 10000 cURL requests per second? How about 50000 cURL requests per second? I mean all 50000 executing at same time?
sofs1
  • 103
  • 3
-1
votes
3 answers

copy files, get file names from a list

I am using a command: xargs -a file_list.txt cp -t /path/to/dest but the filenames with whitespace get cut and therefore are not copied. what can be done?
Rami
  • 1
  • 2
-3
votes
2 answers

Remove all files in directory except last 20

I have question why is my cmd for "removing all files in directory except last 20" not working within cron but in command prompt yes. * * * * * ls -1tr /home/testusr/test | head -n -20 | xargs -d '\n' rm -f > /var/opt/check.log 2>&1 Directory…
1 2
3