I have a pipe delimited input file as below. First byte of the each line indicate the record type. Then i need to split the file based on record_type = null,0,1,2,6 and create 5 files. How do i do this in a ksh script? Pls help
|sl||SL|SL|SL|1996/04/03|1988/09/15|C|A|sl|||||
0|sl||AX||||SL|1973/04/01|1973/04/01|A|A|sl||||
1|sl|RCBH|OR||desc||sl||2008/04/16||A|novel||||RCBH||||||desc||||||
2|sl|SL|IA|02||desc||MPL||2008/04/16|A|A|novel|632||BUILDING|1 |N|MAIN|ST||1 N MAIN ST||||
6|sl|SL|FL|JD|U31||||||A|B|X|desc||clon8008||BT||2007/12/20|A|A|*|
Thanks Jim... i have used as you suggested,but getting below errors. I am very new to scripting... pls help
awk: syntax error near line 1
awk: illegal statement near line 1
awk: syntax error near line 2
awk: illegal statement near line 2
awk: syntax error near line 3
awk: illegal statement near line 3
awk: syntax error near line 4
awk: illegal statement near line 4
awk: syntax error near line 5
awk: illegal statement near line