Want to split awk command

Hi,
There is an awk command in script and it is running successfully.
I want to split that command in 2 lines.
I have tried using '\' but its not working..
Please suggest me the solution.

Are you ending the line(s) with a backslash surrounded by single quotes (e.g. '\' ) instead of just the backslash (e.g. \)? It's impossible to tell what you did without seeing your code.

Please note that backslash continuation does not work with C shell. It works for awk program files if you are using a POSIX compliant shell.

If you want to get it work on C shell, follow the instructions specified here

Hi ,
I am using only \ and not the '\'.
Definately i will share the code soon...
thanks for your response.

Hi,
Below is the command which i want to split

Hi, 
awk -F"\t" '{printf "%-1s;%-12s;%-2s;%-12s;%-12s;%-1s;%-12s;%-6s;%-12s;%-4s; 
%-12s;%-20s;%-8s;%-3s;%-11s;%-6s;%-15s;%-11s;%-105s;%-70s;%-35s;%-35s;%-35s;%-35s;%-35s;%-35s;%-90s;%-15s;%-70s;%-2s;%-10s;%-4s;%-4s;%-35s;%-60s;%-12s;%-12s;%-35s;%-70s;\n",$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39}' san 

Where san is the file name
Thanks in Advance

Copy, paste and run below code:

awk -F"\t" '
{
printf "%-1s;%-12s;%-2s;%-12s;%-12s;%-1s;%-12s;%-6s;%-12s;%-4s;%-12s;%-20s;%-8s; \
        %-3s;%-11s;%-6s;%-15s;%-11s;%-105s;%-70s;%-35s;%-35s;%-35s;%-35s;%-35s;%-35s; \
        %-90s;%-15s;%-70s;%-2s;%-10s;%-4s;%-4s;%-35s;%-60s;%-12s;%-12s;%-35s;%-70s;\n", \
        $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,\
        $14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26, \
        $27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39;
} ' san

I think you'll find that Yoda's suggestion add lots of additional spaces to the output at the line breaks in his code. I think the following will do what you want:

awk -F"\t" '{printf "%-1s;%-12s;%-2s;%-12s;%-12s;%-1s;%-12s;%-6s;%-12s;" \
    "%-4s;%-12s;%-20s;%-8s;%-3s;%-11s;%-6s;%-15s;%-11s;%-105s;%-70s;%-35s;" \
    "%-35s;%-35s;%-35s;%-35s;%-35s;%-90s;%-15s;%-70s;%-2s;%-10s;%-4s;%-4s;" \
    "%-35s;%-60s;%-12s;%-12s;%-35s;%-70s;\n",$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,
    $11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,
    $30,$31,$32,$33,$34,$35,$36,$37,$38,$39}' san

Hi I tried Yoda's suggesstion but it is not working.
It is giving following error:

awk:0602-512 The string %-1s;%-12s cannot contain a newline character.The source line is 1.
The error context is 
       {printf "%-1s;%-12s;'%-2s;%-12s;%-12s;%-1s;%-12s;%-6s;%-12s;%-4s;%-12s;%-20s;%-8s;\>>>
<<<
Syntax Error The source line is 2.

awk:0602-502 The statement cannot be correctly parsed.The source line is 2.

awk: Lexical Conventions

So Don Cragun's suggestion should be the correct syntax..

Could this help you ?

awk -F "\t" 'BEGIN{f[1]=1 ;f[2]=12; f[3]=2;f[4]=12;f[5]=12;f[6]=1;f[7]=12;f[8]=6;f[9]=12;
f[10]=4;f[11]=12;f[12]=20;f[13]=8;f[14]=3;f[15]=11;f[16]=6;f[17]=15;f[18]=11;f[19]=105;f[20]=70;
f[21]=35;f[22]=35;f[23]=35;f[24]=35;f[25]=35;f[26]=35;f[27]=90;f[28]=15;f[29]=70;f[30]=2;
f[31]=10;f[32]=4;f[33]=4;f[34]=35;f[35]=60;f[36]=12;f[37]=12;f[38]=35;f[39]=70;
}
{ for (i=1;i<=39;i++) {
printf "%-"f"s;",$i
}
}
END {printf "\n";} Filename

Another option:

awk -F'\t' -v width="1 12 2 12 12 1 12 6 12 4 12 20 8 3 11 6 15 11 105 70 35 35 35 35 35 35 90 15 70 2 10 4 4 35 60 12 12 35 70" ' 
  BEGIN{
    m=split(width, W, / /)
  }
  {
    for (i=1; i<=m; i++) printf "%-" W "s" OFS, $i; print x
  }
' OFS=\; file

With a function:

awk 'function f(s,w) {printf "%-"w"s", s}
{
f($1,1)
f($2,12)
f($3,2)
...
}
{print ""}' file