..I am using awk to split file and I have a syntax error while executing the below code
[awk '!/^$/{ a=substr($0,1,4) print $0 > "SBSCR." a ".txt"}' harsha1.txt
syntax error The source line is 1.
The error context is
!/^$/{ a=substr($0,1,4) >>> print <<< $0 > "SBSCR." a ".txt"}
awk: The statement cannot be correctly parsed.
The source line is 1.
]
I am using AIX 7.2 and this code worked fine previously.I am an awk dummy..please help what the synax error..please help me debug the code.
awk '!/^$/{ a=substr($0,1,4) print $0 > ("SBSCR." a ".txt")}' harsha1.txt
Note, however, that awk has a limited number of file descriptors available for use in creating output files. You may need to add logic to your code to close the previous output file when you switch to a new output file.