Jump to content

Category:UnixPipes: Difference between revisions

Adding a new tool unfold
No edit summary
(Adding a new tool unfold)
Line 4:
 
Using utilities from, [http://packages.debian.org/unstable/utils/moreutils moreutils]
 
'''unfold'''
 
Defining unfold as the opposite of xargs, i.e take a list of arguments and send them one at a time.
The definition would be
<lang bash>
|cat unfold
num=$1
while read xxx; do
for i in $xxx; do
echo $i
done |xargs -n $num echo
done
 
|echo 1 2 3 4 5 6 7 8 |unfold 3
1 2 3
4 5 6
7 8
 
</lang>
418

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.