0

file1

454.5  465.6532

I tried:

awk '{printf("%8.1f $ %11.4f\\\n", $1, $2)}' file1 > file2

but it gives just

   454.5 $    465.6532\
0
5

Each \ needs to be escaped with a \ - so to get \\ use \\\\:

$ printf '%s\n' '454.5  465.6532' | awk '{printf("%8.1f $ %11.4f\\\\\n", $1, $2)}'
   454.5 $    465.6532\\
1
  • Thank you very much
    – Archie
    Jul 18 '21 at 1:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.