1
2
3 THIS IS THE INPUT FILE � EACH EMPLOYEE MAY HAVE FROM 1 TO 30 RECORDS
4 INPUT
5 1-4 Project
6 5-12 Employee
7 13-14 Sequence (MAYBE FROM 1 TO 30)
8 15-21 Work Code
9 22-22 Pri Code
10
11 9991|80100001|1|0389999|1|
12 9991|80100001|2|7070007|2|
13 9991|80100001|3|4912100|1|
14 9991|80100001|4|5990000|2|
15 9991|80100001|5|2500200|1|
16 9991|80100001|6|41401|2|
17 9991|80100001|7|515|1|
18 9991|80100001|8|4019|2|
19 9991|80100001|9|56210|1|
20
21 THIS IS THE OUTPUT (OPTION ONE)
22 ( NEED ONE CONTIGUOUS RECORD PER EMPLOYEE )
23 OUTPUT = project,employer, workcode,workcode,...,pricode, pricode,...
24 1586|80100001|0389999|7070007|4912100|599000|25002 00|41401|515|4019|56210|1|2|1|2|1|2|1|2|1|
25
26
27 THIS IS THE OUTPUT (OPTION TWO)
28 ( NEED ONE CONTIGUOUS RECORD PER EMPLOYEE WITH OUTPUT CONTAINING ROOM FOR 30 WORK CODES AND 30 PRI CODES )
29
30 1586|80100001|0389999|7070007|4912100|599000|25002 00|41401|515|4019|56210||||||||||||||||||||||1|2|1 |2|1|2|1|2|1||||||||||||||||||||||
31
thank for the help.
***
Please do not embed formatting of font/color/etc... when posting.
s=p=$1 OFS $2 is the same as p=s=$1 OFS $2 . Afterwards both s and p are equal to $1 OFS $2, after the first line this is "9991|90100001"
But where p stays the same, s gets appended with $4's and goes on to grow into the first part of the line to be printed. The second part is t which gets appended with the $5's.
Your version would have worked if you used s!~"^"$1 OFS $2 instead of s!=$1 OFS $2
" s=p=$1 OFS $2 is the same as s=p=$1 OFS $2 " really ???
With the s=p=$1 i was just wondering if the affectation sequence was processed from right to left order but ok, this is the case so it just equivalent to p=$1 ; s=p so at the end s and p have the same value which in fact quite intuitive regarding to the notation, but i wasn't sure.
Because if the affectation would have been processed from left to right , this would have meant a rotation so that it could have been used for shifting field to the left.
Thx you for responding to my request. I'm a novice awk programmer.
If you have the time, could you explain how your solution to the request works? Also how would option two work? Where the output needs 30 work code fields for every employee? If the input record has only ten valid work code fields. but I need to output the ten valid work code fields plus twenty more so that this employee has thirty work code fields in the output file. The invalid fields would be blank.
Again thx you for your assistance.
THX again for your help. I've been out sick for the past days.
I'll try your solution for option 2, and if I have any questions I will get back to you.
THX
All input records will not have the same number of work codes or pri codes.
One input record might have one input work code, then I would need 29 blank field for the output record.
The input number of work codes and pri codes will be different for each employee.
The number of work codes and pri code could also be different for the same employee.
What do I need to change to have it work this way?
THX again for your assisance.