0

I am wondering if it is possible to add content as a single line from different sources. I used paste but it didn't work.

e.g.

x=1
paste echo hi awk NR=="'$x' file.txt echo bye

any ideas?

Thanks

devnull
  • 118,548
  • 33
  • 236
  • 227
user2566898
  • 1,487
  • 2
  • 12
  • 10

1 Answers1

2
echo hi $(awk NR=="$x" file.txt) bye

or add more sources:

echo hi $(awk NR=="$x" file.txt) $(awk NR-1=="$x" file.txt) bye
perreal
  • 94,503
  • 21
  • 155
  • 181