I have two .csv
items-to-change.txt is a single column list of unique ids:
218294 222084 197931 198161 197432 201021 214009
items-by-location.txt has unique ids and location number (tab delimited)
ID Location 197432 1 201021 2 214009 4 214438 5 214492 1 ...
I need to change the location field in items-by-location.txt to 6 for any ID from matches an ID in the items-to-change.txt, then create a new .csv from this, such as items-by-location2.txt
items-by-location2.txt should be:
197432 6 201021 6 214009 6 214438 5 214492 1 ...
Is awk is a good solution for this? I understand that awk has a search parameter, but it is not clear how I would use awk to read through items-to-change.txt get the ID then read line by line the items-by-location.txt, compare the ids and only 2nd column of items-by-location.txt if there is a matching ID in 1st column.
Can someone provide an example?