Hi. I was wondering if I could fix the problem I have with my previous message in a different way. I'm sorry for multiple threads, I'm a newbie to both unix and awk and do not even have a awk book to refer.
I'll repeat the whole issue again.
********************************************************
test.ksh
for i in $dir
do
test.awk i > $dir/(basename i)_C
done
**********
test1.awk
BEGIN{OFS=FS="*"}
/QR/{
for (j=1;j<=NF-7;j++) {
if ($j ~ /QR/ && $(j+1)=="XA" sub(/Z/,"K",$(j+7))
print $0
}
}
*****************************************************
In test.ksh where it is printing the out put, if the if condition satisfies, then only I want to create a file *_C, if it does not I don't want the file created. The above script is creating a *_C file for all the files in directory $dir.
I was wondering if I could print a file in /dir with filename (what ever the file name is, if its is X, the out put file should be X_C) *_C with in the awk script itself.
TIA.
I'll repeat the whole issue again.
********************************************************
test.ksh
for i in $dir
do
test.awk i > $dir/(basename i)_C
done
**********
test1.awk
BEGIN{OFS=FS="*"}
/QR/{
for (j=1;j<=NF-7;j++) {
if ($j ~ /QR/ && $(j+1)=="XA" sub(/Z/,"K",$(j+7))
print $0
}
}
*****************************************************
In test.ksh where it is printing the out put, if the if condition satisfies, then only I want to create a file *_C, if it does not I don't want the file created. The above script is creating a *_C file for all the files in directory $dir.
I was wondering if I could print a file in /dir with filename (what ever the file name is, if its is X, the out put file should be X_C) *_C with in the awk script itself.
TIA.