mrimagepueblo
Programmer
I see another post that is almost what I'm looking for but thought I'd ask about my specific circumstance. Maybe between your input here and the other post I can figure out what I need.
I'd like to get away from using microsoft access to do these queries.
I know how to do this in a #!/bin/sh script using the sed command, but the contents of filea.txt change so that would mean hard coding in the variables each time for the subsitution. I'd like it to be dynamic since both filea.txt and fileb.txt change daily.
hard coded way.
perl -pi -e 's/\|1234\|Larry\|/g' fileb.txt
I'd rather append the change to the end of the file instead of replacing the data.
Employess Numbers and Names
filea.txt ( one variable id field 3 is unique,no duplicates on that field), however contents of filea.txt can change from time to time.
xxxx|xxxx|1234|Larry|xxxx|
xxxx|xxxx|3456|curly|xxxx|
xxxx|xxxx|7890|Moe|xxxx|
fileb.txt (employees time cards)
xxxx|xxxxx|xxxx|7890|xxxx|
xxxx|xxxxx|xxxx|3456|xxxx|
xxxx|xxxxx|xxxx|7890|xxxx|
xxxx|xxxxx|xxxx|1234|xxxx|
xxxx just represents miscellaneous data, can be of varying length and type.
I would like the result to be either in fileb.txt or it doesn't matter if a new file is created filec.txt
xxxx|xxxxx|xxxx|7890|xxxx|Moe|
xxxx|xxxxx|xxxx|3456|xxxx|Curly|
xxxx|xxxxx|xxxx|7890|xxxx|Moe|
xxxx|xxxxx|xxxx|1234|xxxx|Larry|
If someone can get me started on creating/reading in an array for filea.txt and then some code to work with for either appending to fileb.txt or creating a new filec.txt I would greatly appreciate it.
I have several files/situations where this would occur, so the field placements will be different. Ie. In another filea.txt the id could be field5. In another fileb.txt the code could be in field 10, etc.
I'd like to get away from using microsoft access to do these queries.
I know how to do this in a #!/bin/sh script using the sed command, but the contents of filea.txt change so that would mean hard coding in the variables each time for the subsitution. I'd like it to be dynamic since both filea.txt and fileb.txt change daily.
hard coded way.
perl -pi -e 's/\|1234\|Larry\|/g' fileb.txt
I'd rather append the change to the end of the file instead of replacing the data.
Employess Numbers and Names
filea.txt ( one variable id field 3 is unique,no duplicates on that field), however contents of filea.txt can change from time to time.
xxxx|xxxx|1234|Larry|xxxx|
xxxx|xxxx|3456|curly|xxxx|
xxxx|xxxx|7890|Moe|xxxx|
fileb.txt (employees time cards)
xxxx|xxxxx|xxxx|7890|xxxx|
xxxx|xxxxx|xxxx|3456|xxxx|
xxxx|xxxxx|xxxx|7890|xxxx|
xxxx|xxxxx|xxxx|1234|xxxx|
xxxx just represents miscellaneous data, can be of varying length and type.
I would like the result to be either in fileb.txt or it doesn't matter if a new file is created filec.txt
xxxx|xxxxx|xxxx|7890|xxxx|Moe|
xxxx|xxxxx|xxxx|3456|xxxx|Curly|
xxxx|xxxxx|xxxx|7890|xxxx|Moe|
xxxx|xxxxx|xxxx|1234|xxxx|Larry|
If someone can get me started on creating/reading in an array for filea.txt and then some code to work with for either appending to fileb.txt or creating a new filec.txt I would greatly appreciate it.
I have several files/situations where this would occur, so the field placements will be different. Ie. In another filea.txt the id could be field5. In another fileb.txt the code could be in field 10, etc.