Skip to main content
Became Hot Network Question
edited title to be more inline with the content
Source Link
don_crissti
  • 85.7k
  • 31
  • 234
  • 262

xargs echotreat multiple lines into oneas arguments to single command invocation

I am having a hard time print a seq of number, and then appending something at the end.

seq 1 3 | xargs -I {} echo {} 4

results in

1 4
2 4
3 4

However I want the result to be

1 2 3 4

Since I am learning xargsxargs, I only want to use xargsxargs to achieve this.

xargs echo multiple lines into one

I am having a hard time print a seq of number, and then appending something at the end.

seq 1 3 | xargs -I {} echo {} 4

results in

1 4
2 4
3 4

However I want the result to be

1 2 3 4

Since I am learning xargs, I only want to use xargs to achieve this.

xargs treat multiple lines as arguments to single command invocation

I am having a hard time print a seq of number, and then appending something at the end.

seq 1 3 | xargs -I {} echo {} 4

results in

1 4
2 4
3 4

However I want the result to be

1 2 3 4

Since I am learning xargs, I only want to use xargs to achieve this.

Source Link
infoclogged
  • 1k
  • 2
  • 15
  • 26

xargs echo multiple lines into one

I am having a hard time print a seq of number, and then appending something at the end.

seq 1 3 | xargs -I {} echo {} 4

results in

1 4
2 4
3 4

However I want the result to be

1 2 3 4

Since I am learning xargs, I only want to use xargs to achieve this.