Adding Fields to the file

view story

http://www.unix.com – Hi All, I get a file on weekly basis from client. I need to write a script which make sure the file should have 20 columns after the first column. If not then the script should add the remaining columns and default them to space(except for 2nd and 3rd). and at the same time the script should check the second and the third column if null then default those to ND. Sample Input file: 0000000000||3|MAIL ORDER|MAIL ORDER DATA|N/A|MAIL ORDER|N/A| 0000010001|CASH||CASH|CASH|N/A|CASH|N/A| 0000020002|FFS MED|2|AL MEDICAID|MEDICAID|N/A|AL MEDICAID|N/A|"Tier2,PA|NPF" Sample Outfile Req (HowTos)