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
  • 111,086
  • 29
  • 224
  • 214
user2566898
  • 1,449
  • 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
  • 90,214
  • 20
  • 145
  • 172