Mostrar arquivos:
head *
... o que gera:
==> file.csv <==
Year,WeekOfYear,DaysInWeek,USAIsBankHoliday,holidays,**user_id**
2013,1,5,2,1,1
2013,1,5,2,1,2
2013,1,5,2,1,3
==> user_ids_to_keep.csv <==
1
3
5
Código Ugley POSIX, (pode ser copiado como one-liner):
{ read x ; echo $x ; \
while read x ; \
do for f in 'cat user_ids_to_keep.csv' ; \
do n=${x#${x%,*},} ; \
if [ $n = $f ] ; \
then echo $x ; \
continue ; \
fi ; \
done ; \
done ; } < file.csv | tee output.csv
Exibe:
Year,WeekOfYear,DaysInWeek,USAIsBankHoliday,holidays,**user_id**
2013,1,5,2,1,1
2013,1,5,2,1,3