I am using a bash script where I must store the last n-2 lines of a file in a variable. The command I use for this is
last_n2_lines=`tail -n+3 $file`
Now whenever i echo the $last_n2_lines variable, I get all the lines of my file in a single line. How can I get the same formatting as I had in my original file. I tried printf but it just prints the first field.