i have a file in unix in which datas are like this
07 01 abc data entry Z3 data entry ASSISTANT Z3 39
08 01 POD peadiatrist Z4 POD PeDIATRY Z4 67
01 operator specialist 00 operator UNSPECIFIED A0 00
02 OLD NPA SPECIALTY 01 GP GENERAL PRACTICE C5 01
i want the datas to be tilde delimited as
07~01~abc~data entry~Z3~data entry ASSISTANT~Z3~39
~01~~operator specialist~00~operator UNSPECIFIED~A0~00
can anybody help me on this in writing code for this
I'd want more specifications before I could whip up a good script/program. For example, I see it could be lined up. If everything's fixed width, you could just use a cut command to break each line up into manageable bits and then just output the tilde's. Are their always the same number of fields? Are fields 1, 2, 5, 7, and 8 always two digit fields? Can other fields besides 1 and 3 be blank?
I'd do something like read the entire line into an array. I'd check each of the array elements to see if they match rules (like the two digit fields) and put everything in the right place. The only wrench is that third field and what might be in it.
So the basic answer here is, insufficient specifications. Sorry