I want to awk on a fixed length file.
Instead if the file was a delimited file, then I could have used -F and then could have easily done manipulation on the fields.
How do i do the same in case of fixed length file?
Still your requirement is not clear. I'll ask you to put here some sample input and output you require. But for fixed length situation you can try use substr function in awk, like substr($0,1,10) for emp ID and substr($0,11,10) for emp name and so on.
There are going to be a lot of manipulations only if couple of fields' values.
Now if the file was a delimited, i could have written something like
awk '$2=something && $3=somthingelse { some action }'
But now since the file is fixed length, a lot of processing processing time will be wasted just on substring and then check wheten to perform the acton. Any solution?
"Don't use fixed length files" pops quickly to mind. "Switch to tools with support for fixed length files" is another thought. perl is probably the most widespread language with fixed field support.
If you must use awk on a fixed field file, maybe you could insert delimiters first: