awk embedded script issue (unexpected character '\')

I use an embedded awk code in a shell script:

I have some variable assignments at the BEGIN part of it:

\
BEGIN { FS=","; OFS=","; service_not="false"; end_of_line="\n"; is_setup_gps="false"; \
  \
  a=6378137.0 ; \
  b=6356752.3142 ; \
  f=(a-b)/a ; \
  e=sqrt(f*(2-f)) ; \
} \
\

So I need '\' at the end of each line (to have an entire awk script embedded in .sh).

BUT: for the lines: a=...; b=...; f=...; the '\' causing errors...: mawk: 57: unexpected character '\'

Why?

UPD: Embedding of awk in the bash script:

 #!/bin/bash
 ... all shell commands ...
 mawk '... ; \
 ... ; \
 ... ; \
 ' file_to_parse

Answers


The quotes around the AWK script protect the newlines. No backslashes are necessary within them.


Need Your Help

Why does Maven warn me about encoding?

java maven maven-archetype

I am using Maven to manage a project. My goal is to create an archetype from a project.

C++ retrieve exception information

c++ exception try-catch extract-error-message

I have a c++ dll which I need to debug. Due to the circumstances in which I am using the dll, I am unable to debug it via the calling application.