03-02-2011
HI Scrutinizer,
THIS IS THE INPUT FILE
1-4 PROJECT
5-12 EMPLOYEE
13-14 SEQUENCE NO (MAYBE FROM 1 TO 30)
15-21 WORK CODE (MAYBE FROM 1 TO 30)
22-22 PRI CODE (MAYBE FROM 1 TO 30)
|
1586 |
1586 |
1586 |
1586 |
1586 |
1586 |
1586 |
1586 |
1586 |
1586 |
20
THIS IS THE REQUIRED OUTPUT
SORTED BY PROJECT, EMPLOYEE, AND SEQUENCE NO
CONTROL BREAK ON PROJECT AND EMPLOYEE
IN ORDER BY THE SEQ NO THE WORK CODE SHOULD HAVE 30 FILEDS 10 FILLED AND 20 EMPTY
NEXT THE PRI CODE SHOULD ALSO HAVE 30 FIELDS 10 FILLED AND 20 EMPTY
PHP Code:
1586|80100001|0389|70707|49121|5990|25002|41401|515|4019|56210|56999|||||||||||||||||||||1|2|1|2|1|1|2|2|2|1||||||||||||||||
29 |||||
YOUR CODE
PHP Code:
34 awk -F\| 'function pr() {$0=s;NF+=30;$0-$0 t;NF+=30;print} p!=$1 OFS $2{if(s)pr(); t=x; s=p=$1 OFS $2} {s=s OFS $4; t=t OFS $5} END{p
r() }' OFS=\| infile
YOUR CODE RETURN THE FOLLOWING RESULTS
PHP Code:
1586|80100001|0389|70707|49121|5990|25002|41401|515|4019|56210|56999||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
What changes do I need to make to get this to work?
THX
---------- Post updated at 09:42 AM ---------- Previous update was at 09:38 AM ----------
Hi, Scrutinizer
THIS IS THE INPUT FILE
PROJECT
5-12 EMPLOYEE
13-14 SEQUENCE NO (MAYBE FROM 1 TO 30)
15-21 WORK CODE (MAYBE FROM 1 TO 30)
22-22 PRI CODE (MAYBE FROM 1 TO 30)
PHP Code:
1586|80100001|1|0389|1|
1586|80100001|2|70707|2|
1586|80100001|3|49121|1|
1586|80100001|4|5990|2|
1586|80100001|5|25002|1|
1586|80100001|6|41401|1|
1586|80100001|7|515|2|
1586|80100001|8|4019|2|
1586|80100001|9|56210|2|
1586|80100001|10|56999|1|
THX again,
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi folks,
I would like to know the difference between shell programming and awk programming. Actually i have developed a few applications in both but i could not find a better difference other than the syntax differences.
For example, the awk programming syntax is complicated. It has "{" and... (4 Replies)
Discussion started by: Nisha
4 Replies
2. Programming
Im trying to write some code atm which gets the complete pathname of a folder and strips off references to the parent folders. The end result should be just the name of the folder.
Currently Im able to extract the folder name, however Im getting junk added onto the name as well which is making... (7 Replies)
Discussion started by: JamesGoh
7 Replies
3. UNIX for Dummies Questions & Answers
Hello
i need help with following problem:
i need to update a file containing records in following format:
student1
classa
student2
classb
student3
student4
classc
i need to associate EACH student with a class in my output file ... so for students 3 and 4, i need to create a... (12 Replies)
Discussion started by: alrinno
12 Replies
4. UNIX for Advanced & Expert Users
Hi all
I encountered a strange phenomenon when reading / writing to RS232 serial device (on my machine /dev/ttyS0)
I have simple 2 processes:
1) process which WRITE characters from /dev/ttyS0
For example write the characters... (2 Replies)
Discussion started by: dudi.forum
2 Replies
5. Shell Programming and Scripting
i want to calculate power of 10 as follows:
coef=2.0588
ra1=$(awk 'BEGIN{print 10^$coef}')
it gives a result 1
when,
if i calculate
ra1=$(awk 'BEGIN{print 10^2.0588}')
it gives a result 114.499
what should i do? (2 Replies)
Discussion started by: SANGUINE
2 Replies
6. Shell Programming and Scripting
Hi
I have a multi -line file which is sorted by the 1-st colomn in the following format:
400 0000 0001 1000 1010 0111 0000 1000 0000
402 1101 0000 1100 1010 0111 1000 1000 0000
403 1001 0000 1100 1010 0111 0000 1000 0000
495 1000 0000 1100 ... (4 Replies)
Discussion started by: aoussenko
4 Replies
7. Programming
Hi Everybody.
I have an Ubuntu linux 10.04 os and want be able to use the website of intuit but it only runs on unix. Is there any way that I can put the needed drivers in this os since both linux/unix share some distinctive programs.
If this is not possible how can I save the information that I... (1 Reply)
Discussion started by: mk631219
1 Replies
8. Shell Programming and Scripting
Hi All,
I read the AWK manual in the MAN page. But i didn't understand the below piece of code in the script
TABLE=`echo "${FILE}" | awk -F"/" '{print $NF}' | cut -d"." -f1 | awk -F"_" '{print $NF}' 2>> ${LOGFILE}`;
Please explain the above code.
Thanks in advance .......
Regards,... (4 Replies)
Discussion started by: pdathu
4 Replies
9. Programming
Dear Linux users,
I'm a noob at openmp, gcc and c programming. I can run my own openmp code in terminal with no problem, eg. gcc -fopenmp program.c -o program.
But now I'm trying to compile and run another person's code, it contains a makefile and multiple .c and .h files. I don't know how to... (2 Replies)
Discussion started by: pigeon151
2 Replies
10. Shell Programming and Scripting
Hi All,
I am new to AWK programming. I have the following for loop in my awk program.
cat printhtml.awk:
BEGIN
-------- <some code here>
END{
----------<some code here>
for(N=0; N<H; N++)
{
for(M=5; M<D; M++) print "\t" D "";
}
-----
}
... (2 Replies)
Discussion started by: ctrld
2 Replies