Basically, I have two files
dupestest.txt
152,153
192,193,194
215,216
290,291
2279,2280 2282,2283
haftest.txt
152,ABBOTS ROAD
153,ABBOTS ROAD
154,ABBOTS ROAD
155,ABBOTS ROAD
156,ABBOTS ROAD
157,ABBOTS ROAD
I want to find the numbers in dupestest.txt in haftest.txt and produce this outcome: results.txt
152,ABBOTS ROAD,153 ABBOTS ROAD
192,ABBOTS ROAD, 193,ABBOTS ROAD, 194,ABBOTS ROAD
etc
(the numbers are just the count they are not premise numbers)
I have been told to try
awk -F, 'BEGIN{OFS=","} FNR==NR{a[$1]=$2; next} $1 in a || $2 in a{print $1, a[$1], $2, a[$2]}' haftest.txt dupestest.txt
But I want to do it in Notepad and save it as a AWK file instead of just a command line.I am totally new to AWK and have started with this:
BEGIN
{
OFS=",";
}
FNR==NR
{
street[$1]=$2
}
End
Can anyone give me any advice?
It has to be in awk.