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 is a command on Unix and most Unix-like operating systems used to build and execute command lines from standard input. Under the Linux kernel before version 2.6.23, arbitrarily long lists of parameters could not be passed to a command, so xargs breaks the list of arguments into sublists small enough to be acceptable.

xargs often covers the same functionality as the backquote(`) feature of many shells, but is more flexible and often also safer, especially if there are blanks or special characters in the input. It is a good companion for commands that output long lists of files like find, locate and grep, but only if you use -0, since xargs without -0 deals badly with file names containing ', " and space.

1303 questions
0
votes
2 answers

Using xargs twice in one line for to fix subversion «!» status

I find the best solution for my problem here: Howto fix subversion «!» status But now, I just wish to write a small script to do that. Like this: svn status | grep '\!' | awk '{print $2}' | xargs svn revert svn status | grep '\!' | awk '{print $2}'…
0
votes
1 answer

Recursive Search and replace with / and '

I have searched and not found a solution so sorry if this has been answered before, I'm not great at shell. I'm trying to do a recursive search and replace in all files via SSH. So far I've got this: find . -type f | xargs -d "\n" perl -pi -e…
0
votes
3 answers

Escape single quotes in long directory name then pass it to xargs [Bash 3.2.48]

In my directory I have subfolders, and I want to list all directories like this: - ./subfolder - ./subfolder/subsubfolder1 - ./subfolder/subsubfolder2 - ./subfolder/subsubfolder2/subsubsubfolder I want to list this…
szantaii
  • 165
  • 2
  • 11
0
votes
1 answer

xargs string used as an input for agrep

Guys I am using xargs to pass the input for a agrep.I am using xargs like the below Script: xargs -L 1 -I string echo "RequestId="string | xargs -L 1 -I string zcat FILEB | agrep -dEOE string Output till…
User
  • 401
  • 2
  • 8
  • 15
0
votes
2 answers

Using Xargs to read the input from a console

This is the script I have written zgrep -i xxxx FileA | grep -o "RID=[0-9|A-Z]*" | uniq | cut -d "=" -f2 | xargs Before the point of xargs being used my o/p is 01982893213982312 - RID 1 32103213213213213 - RID 2 32103213213213343 - RID…
User
  • 401
  • 2
  • 8
  • 15
0
votes
2 answers

Regarding the use of xargs in find command

I have one scenario where I need to select all files having aliencoders.numeric-digits like alienoders.1206 and find command should search all subdirectories too. If there is no such file it should not do anything. I wrote : find /home/jassi/ -name…
Jassi
  • 521
  • 6
  • 31
0
votes
3 answers

Slice 3TB log file with sed, awk & xargs?

I need to slice several TB of log data, and would prefer the speed of the command line. I'll split the file up into chunks before processing, but need to remove some sections. Here's an example of the format: uuJ oPz eeOO 109 66 8 uuJ oPz eeOO …
HappyTimeGopher
  • 1,377
  • 9
  • 14
-1
votes
1 answer

How to solve issue Argument list too long in grep command?

How to solve issue Argument list too long in grep command? I need to execute grep command grep '^ORA' '/log/bssuser/CDR/Postpaid_CDR_Log/'*.log > output.txt I have error : -bash: /usr/bin/xargs: Argument list too long
-1
votes
2 answers

How to open all files grep finds containing a certain text, recursive

I type grep -r 'something' . and grep finds a lot of hits. Now I want to open all files that were found. I try grep -r 'something' . | xargs vim nothing happens.
Duck
  • 34,902
  • 47
  • 248
  • 470
-1
votes
1 answer

how to change user password in ubuntu using xargs

I need to change the password of "vtm" user to "abcd12345" by using xargs command. so I wrote this comman printf "vtm abcd12345 abcd12345" | xargs -t -n1 passwd but I couldn't change it.
Vitamin
  • 21
  • 4
-1
votes
1 answer

How can capture args with xargs across multiple pipe in bash

I have this command kubectl get ns -l app=sample-api | awk '/fast/{print $1}' | xargs -I {} helm list --short -n {} | xargs -I {} helm delete -n ?? {} Suppose that argument from first xargs is $1 and it gets subsituted in like helm list --short -n…
rgd
  • 346
  • 1
  • 4
  • 15
-1
votes
1 answer

How to source bash script in zsh

I have bash script which heavily uses bash features and does not run in zsh, dash, and sh. My prefered shell is zsh. How can I source this bash script into zsh shell ? I tried function in() { bash -c "'$@ ; exec zsh'" } but this gives me syntax…
너를 속였다
  • 899
  • 11
  • 26
-1
votes
1 answer

how to use awk in bash -c do the ' ' in awk ' ' doesn't break the bash -c ' ' bash?

At the begining i have this scipt that put the stdout in a file.txt : find .. -type f -not \( -path '/dev/*' -or -path '/proc/*' -or -path '/sys/devices/*' \) -print0 | xargs -0 bash -c 'paste -d ";" <(md5sum "$@") <(sha1sum "$@") <(sha256sum…
akmot
  • 63
  • 8
-1
votes
1 answer

mv/cp commands not working as expected wih xargs in bash

Hi I have 2 parent directories with these contents, under /tmp: Note parent directory names have ";" in it- not recommended in Unix like systems, but those directories are pushed by an external application, and that's the way we have to deal with…
dig_123
  • 2,240
  • 6
  • 35
  • 59
-1
votes
1 answer

How to grep text patterns from remote crontabs using xargs through SSH?

I'm developping a script to search for patterns within scripts executed from CRON on a bunch of remote servers through SSH. Script on client machine -- SSH --> Remote Servers CRON/Scripts For now I can't get the correct output. Script on client…
donmelchior
  • 893
  • 3
  • 13
  • 31