Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Consider the output:

% { echo one; echo two; echo three; } | xargs -I{} -L1 echo test-{} 
test-{} one
test-{} two
test-{} three

Why doesn't {} get substituted as per the manual page (and my memory, too)?

How to change the command line to get test-one, test-two, test-three lines as output?

share|improve this question

3 Answers 3

up vote 8 down vote accepted

Remove the -L 1; it is implied by -I (as the man page says), but it would override it when specified afterwards.

share|improve this answer

It works without "-L1", because it is implicitly set.

{ echo one; echo two; echo three; } | xargs -I{} echo test-{}
share|improve this answer

If you have GNU Parallel installed you can do this:

{ echo one; echo two; echo three; } | parallel echo test-{}

You can install GNU Parallel simply by:

chmod 755 parallel
cp parallel sem

Watch the intro videos for GNU Parallel to learn more:

share|improve this answer
+1, this is a nice script. – ulidtko May 9 '12 at 22:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.