I have a large CSV file(~1GB) - data.csv
A variable with a huge list of Pipe separated strings.
list="abc|def|ghi.........."
Objective is to search 2nd and 3rd columns of data.csv
for each and every string listed in list
variable and replace it with the string unassigned
Below is what i came up with,
awk -v list="$list" 'BEGIN{FS=OFS=","}{gsub(list,"unassigned",$2)}{gsub(list,"unassigned",$3)}1' data.csv > data_new.csv
It works fine as long as the list is small. Once the list variable crosses around 10k strings, it'll throw the error
/usr/bin/awk: Argument list too long
Is there any solution to handle this long list here? Totally new solution is also welcome. Thanks in advance.
Note : Would prefer to avoid looping through list since it degrades the performance.