Questions tagged [xargs]
xargs is a command on Unix and most Unix-like operating systems used to build and execute command lines from standard input.
xargs
1,319
questions
0
votes
3
answers
81
views
Pass multiple arguments to single command in custom position xargs
I want execute a command where I have the args as single string but they need to be in a custom position. E.g. in the following example I want the args to be positioned before any fixed args that I ...
0
votes
0
answers
15
views
Visual Studio Terminal Error When Connected to Ubuntu 22.04 WSL
I use WSL for development. When I start Visual Studio Code and connect it to an Ubuntu 22.04 WSL instance, I always get this error when launching VS's Terminal:
xargs: unmatched double quote; by ...
0
votes
1
answer
18
views
How do I speed up Git submodule init + update
I have a repo with a lot of submodules, and it takes a long time to initialise all of them from a fresh checkout.
git submodule update --init
seems to do everything in series, when the operation ...
0
votes
1
answer
33
views
Is there a way to take the output of xargs and combine any stderr and stdout into a single line so there is only one line per command run?
I have a long list of symbolic links to python venvs that I would like to run the --version flag on. Some of the links are broken and some of the Python binaries require other versions of glibc than ...
0
votes
2
answers
133
views
Tar piping creates error during run and stops
I am running a larger copy job online.
I am using tar for that piped to xargs.
My command looks like this:
tar cvf - --sort=name --ignore-failed-read -C /pathto/source . | pv | xargs -n 1 -P 32 $(tar ...
0
votes
0
answers
20
views
Curl sending requests in parallel extremely slow
I tried to use curl command to send HTTP requests in parallel like echo {1..10} | xargs -n1 -P10 curl -s -o /dev/null https://www.google.com. The command run on my Mac is super fast (less than 1s), ...
0
votes
0
answers
41
views
Move large files(in GBs) in parallel
I have a use case, where we need to move large files from openshift to another server. Each files are in GBs. Total size of files were few Terabytes. I'm using oc rsync/cp feature to move files.But it'...
0
votes
1
answer
46
views
grep for string and open matching files in text editor
I wasn't able to find an answer for this simple question. I had a solution for it years ago and I think it involved something like { }, but I've totally forgotten now.
I'm looking to grep for a ...
1
vote
1
answer
72
views
find and grep - Suppress terminated by signal 13
If I want to find only first match of command grep I use this:
find -name "*.jar" | xargs grep -al myText | head -1
And it's work just fine.
But it's also show the next message:
xargs: grep:...
0
votes
4
answers
72
views
pipe stdio to a function
Noob question!
I've got a function on the command line that takes parameters
sqr() { echo $(( $1 * $1 )) ; }
sqr 4 echos 16. fine.
Now I want to pipe an output to this function
echo 4 | sqr
I get &...
0
votes
1
answer
35
views
What is the difference between xargs with a single command and with a complex command?
I am contemplating about some nuances of xargs.
Reading the question:
(
what is the difference between -L and -n in xargs
)
I feel irritated.
When I use a multiple argument command sh -c "...&...
0
votes
4
answers
106
views
Bash: How to extract parent directory of 3 files at a time
I have file names like this:
/foo/bar/bazz/JMA01023D_E07/JMA01023D_E07_EKDL230054768-1A_22HFKNLT3_L4_1.fq.gz
/foo/bar/bazz/JMA01023D_E08/JMA01023D_E08_EKDL230054768-1A_22HFKNLT3_L4_1.fq.gz
/foo/bar/...
0
votes
0
answers
75
views
Xargs to cd for files with spaces on mac
I have referred to quite a few answers on SO but haven't been able to figure out a solution for this.
What I am trying to do is to have a cd command that uses fzf to match the directory to jump into. ...
1
vote
2
answers
123
views
Strange xargs Behavior with special characters within variable
I'm running into strange behavior with xargs in a bash script where the replacement is not working anymore when placing it in the middle of a variable with special characters. Please see the following:...
0
votes
2
answers
55
views
Docker ps command into XARGS command to check and auto restart unhealthy containers
docker ps -f health=unhealthy --format "docker restart {{.ID}}" | xargs --no-run-if-empty -t docker restart
output is :
docker restart docker restart 7c20974e2b02
7c20974e2b02
Error ...