Hi All,
I have 2 data files:
#1) Customer.txt which has the following:
ARRON, Germany, Sales, Jack
PHILLIP, Sweden, Programmer, Anna
JERRY, Mexico, Administrator, John
....and so on....
#2) Order.txt which has the following
203, PHILLIP, 9-Jul-88, 13-Sep-03
1429, ARRON, 12-Sep-86, 8-Feb-87
894, JERRY, 3-Sep-86, 8-Mar-99
....and so on....
I want to write an awk script that would output this:
ARRON, Germany, Sales, Jack, 1429, 09/12/1986, 02/08/1987
JERRY, Mexico, Administrator, John, 894, 09/03/1986, 03/08/1999
But I want the records to only Sep of 86 and to output in that format. I wrote an awk script that it parses out the first file, but don't know how to include the second file to the same awk script.
Here's my script.
#!/usr/bin/awk -f
BEGIN{
FS=","
OFS="\t"
}
{
custid = $1
if (custid == "AARON" || "JERRY" || custid == "PHILLIP" {
country = $9
if ((country ~ /[A-Z][a-z]/) || (country ~ /[a-z][A-Z]/)) {
print $1,$2,$4,$9
} else {
print $1,$2,$4,$10
}
} else {
# print $1
}
}
Any help would be greatly appreciated. Thanx!
As Always,
...Robert
I have 2 data files:
#1) Customer.txt which has the following:
ARRON, Germany, Sales, Jack
PHILLIP, Sweden, Programmer, Anna
JERRY, Mexico, Administrator, John
....and so on....
#2) Order.txt which has the following
203, PHILLIP, 9-Jul-88, 13-Sep-03
1429, ARRON, 12-Sep-86, 8-Feb-87
894, JERRY, 3-Sep-86, 8-Mar-99
....and so on....
I want to write an awk script that would output this:
ARRON, Germany, Sales, Jack, 1429, 09/12/1986, 02/08/1987
JERRY, Mexico, Administrator, John, 894, 09/03/1986, 03/08/1999
But I want the records to only Sep of 86 and to output in that format. I wrote an awk script that it parses out the first file, but don't know how to include the second file to the same awk script.
Here's my script.
#!/usr/bin/awk -f
BEGIN{
FS=","
OFS="\t"
}
{
custid = $1
if (custid == "AARON" || "JERRY" || custid == "PHILLIP" {
country = $9
if ((country ~ /[A-Z][a-z]/) || (country ~ /[a-z][A-Z]/)) {
print $1,$2,$4,$9
} else {
print $1,$2,$4,$10
}
} else {
# print $1
}
}
Any help would be greatly appreciated. Thanx!
As Always,
...Robert