Hi, all
I get many keys to extract records in other files. However, following scripts doesn't spell out what I expected.
Both the keyfile and to be extracted files are tab dlimited.
# keys in three column
for keycol in 1 2 3
do
# creat a vector containing the key
for key in `awk -F"\t" '{print $x}' x=$keycol keyfile | uniq`
do
# extracts records in another files when the key match
awk -F"\t" -v y=$key '$5 >=19950101 && $10==y ' MF8098_dfc MF9906_dfc >> "$keycol"_MF_extraction
done
done
the results are three extracted files, each results from matching keys in the corresponding column of the keyfile.
problem
1. uniq(key in an extracted file ) does not match uniq(key in key in the corresponding key column of the key file ),
2. and the number of records in the extracted file evidently surpassed its theoretic limits
3. the scripts really runs slow, is there any faster way to do that?
Thank you for suggestion
Will
I get many keys to extract records in other files. However, following scripts doesn't spell out what I expected.
Both the keyfile and to be extracted files are tab dlimited.
# keys in three column
for keycol in 1 2 3
do
# creat a vector containing the key
for key in `awk -F"\t" '{print $x}' x=$keycol keyfile | uniq`
do
# extracts records in another files when the key match
awk -F"\t" -v y=$key '$5 >=19950101 && $10==y ' MF8098_dfc MF9906_dfc >> "$keycol"_MF_extraction
done
done
the results are three extracted files, each results from matching keys in the corresponding column of the keyfile.
problem
1. uniq(key in an extracted file ) does not match uniq(key in key in the corresponding key column of the key file ),
2. and the number of records in the extracted file evidently surpassed its theoretic limits
3. the scripts really runs slow, is there any faster way to do that?
Thank you for suggestion
Will