May 2017
Beginner
552 pages
28h 47m
English
The xargs command supplies arguments to a target command by reformatting the data received through stdin. By default, xargs will execute the echo command. In many respects, the xargs command is similar to the actions performed by the find command's -exec option:
Xarg's default echo command can be used to convert multiple-line input to single-line text, like this:
$ cat example.txt # Example file
1 2 3 4 5 6
7 8 9 10
11 12
$ cat example.txt | xargs
1 2 3 4 5 6 7 8 9 10 11 12
The -n argument to xargs limits the number of elements placed on each command line invocation. This recipe splits the input into multiple ...