I have four files and want to run a awk code on each file. But this code is not working.
My code:
for i in "udp-250b.tr" "udp-50b.tr"
do
awk '
BEGIN {
//some code
}
{
//some code
}
END {
//some code
} ' i
done
Advertisement
Answer
Awk can work with multiple files no need of for
syntax will be like this
awk '{ }' file1 file2 file3
or
awk '{ }' file*
In your case
awk 'BEGIN{ } { } END{ }' udp-*.tr
To correct your existing code change
} ' i
To
} ' "$i"