awklearner
Technical User
Hello everyone.
Just start learning awk. Don't know what to do.Please Help me.
My Question is
(Part1)
I have some data files.
example
Balance1.txt
AA 10
BB 11
CC 34
Balance2.txt
CC 11
AA 10
BB 13
Balance3.txt
BB 11
AA 10
CC 13
I don't know how many Balance files is going to use but I know all files have same number of records and they don't have duplicate records.
What I am trying to print out is
awk -f printout.awk Balance1.txt Balance2.txt
Name Balance1 Balance2
AA 10 10
BB 11 13
CC 34 11
(part2)
if the record is missing in the file, the field value will be zero.
for example,
Balance4.txt
AA 11
DD 20
awk -f printout2.awk Balance1.txt Balance2.txt Balance4.txt
Name Balance1 Balance2 Balance4
AA 10 10 11
BB 11 13 0
CC 34 11 0
DD 0 0 20
I think part2 is more difficult than part1.In part1, I tried to do with arrays but I didn't get it. Thanks in advance.
Just start learning awk. Don't know what to do.Please Help me.
My Question is
(Part1)
I have some data files.
example
Balance1.txt
AA 10
BB 11
CC 34
Balance2.txt
CC 11
AA 10
BB 13
Balance3.txt
BB 11
AA 10
CC 13
I don't know how many Balance files is going to use but I know all files have same number of records and they don't have duplicate records.
What I am trying to print out is
awk -f printout.awk Balance1.txt Balance2.txt
Name Balance1 Balance2
AA 10 10
BB 11 13
CC 34 11
(part2)
if the record is missing in the file, the field value will be zero.
for example,
Balance4.txt
AA 11
DD 20
awk -f printout2.awk Balance1.txt Balance2.txt Balance4.txt
Name Balance1 Balance2 Balance4
AA 10 10 11
BB 11 13 0
CC 34 11 0
DD 0 0 20
I think part2 is more difficult than part1.In part1, I tried to do with arrays but I didn't get it. Thanks in advance.