Xargs
Xargs
Set tab as delimiter (default:space)
xargs -d\tPrompt commands before running commands
ls|xargs -L1 -p headDisplay 3 items per line
echo 1 2 3 4 5 6| xargs -n 3
# 1 2 3
# 4 5 6Prompt before execution
echo a b c |xargs -p -n 3Print command along with output
xargs -t abcd
# bin/echo abcd
# abcdWith find and rm
Delete files with whitespace in filename (e.g. "hello 2001")
Show limits on command-line length
Move files to folder
Move first 100th files to a directory (e.g. d1)
Parallel
Copy all files from A to B
With sed
Add the file name to the first line of file
Count all files
Turn output into a single line
Count files within directories
Count lines in all file, also count total lines
Xargs and grep
Xargs and sed (replace all old ip address with new ip address under /etc directory)
Last updated
Was this helpful?