tr -s \[:blank:] , <a.txt| #dont mess with weird columns
cut -d, -f1 | sort -u | #drop all but unique first column entries
sed -e's/[]*^\./$[]/\\&/g'\ #handle any regex metachars properly
-e's/.*/^[^,]*,&,/' | #match only second column
grep -nf - -- b.txt | #get line numbers at head of matched lines
sed -e's/:.*/be/' | #keep only matched line numbers + 'be'
sed -f - -eb -e:e \ #branch away or append turkish
-e's/$/turkish/' -- b.txt
mehmet,trabzon,,turkish
murat,istanbul,,turkish
john,london,,
Locane
13.01.2018, 04:56
Ссылка