Hello All,
I thought I had this working, but it doesn't want to redirect the output to a series of files.
Background is: I have a text file from which I want to extract 2 variables, $4 and $6. For each instance of $4 I want to print the contents of the variables $4 and $6 to an external file named using the $4 variable.
I have the bulk of the script working, but I cannot get the script to generate and print the contents of the $4 and $6 variables to the individual files..
I have attached a copy of the code below.
BEGIN {
}
{
contact_name=$4
contact_number=$6
file_name=$4".vcf"
{ print "N:"$4"\n" "TEL;CELL;VOICE:"$6 > $file_name }
}
END {
}
Any help would be appreciated.
Regards
Alf
PS: I am running awk with the -f parameter and submitting the source data file on the command line when the script is run.
I thought I had this working, but it doesn't want to redirect the output to a series of files.
Background is: I have a text file from which I want to extract 2 variables, $4 and $6. For each instance of $4 I want to print the contents of the variables $4 and $6 to an external file named using the $4 variable.
I have the bulk of the script working, but I cannot get the script to generate and print the contents of the $4 and $6 variables to the individual files..
I have attached a copy of the code below.
BEGIN {
}
{
contact_name=$4
contact_number=$6
file_name=$4".vcf"
{ print "N:"$4"\n" "TEL;CELL;VOICE:"$6 > $file_name }
}
END {
}
Any help would be appreciated.
Regards
Alf
PS: I am running awk with the -f parameter and submitting the source data file on the command line when the script is run.