0

I am having a problem printing something using the awk command on Linux. I have a file and i use the following line:

x="something";awk -v x="$x" '{print $0,x}' myfile.txt

I want to print the whole file ($0) and then at the end of every line the x variable. However this x variable for some reason goes at the beginning of the file and not at the end. This is a sample of my file and the output.

enter image description here

I don't know what is the problem but it is really getting on my nerves!! Thanks!!

Cyrus
  • 69,405
  • 13
  • 65
  • 117
fizz fish
  • 27
  • 3

0 Answers0