file1.txt (There are no duplicates in this file)
1234
3232
4343
3435
6564
6767
1213
file2.txt
1234,wq,wewe,qwqw
1234,as,dfdf,dfdf
4343,asas,sdds,dsds
6767,asas,fdfd,fdffd
I need to search each number in file1.txt in file2.txt's 1st field (fields are delimited by comma in file2.txt). If the match is not found in file2.txt then i need to put the unmatched numbers from file1.txt to file3.txt
output
file3.txt
3232
3435
6564
1213
can anyone give me a solution.
If possible using awk, since it is faster i believe.
i am using HP-UX. there is no nawk or gawk commands on this.
Can i do it using any other command which takes less time?
currently i am using the below block
but i guess it will take a lot of time. There are more than 10000 lines in a file.
while read line
do
search_count=`grep -c $line file2.txt`
echo $grepped
if [ $grepped -eq 0 ]; then
echo $line >> unfetch.txt
fi
done < file1.txt