i create simple shell script (test.sh) to do grep from a big file (source.txt) using 1 file contains with a list of string (list.txt) then put the result to a new file (result.txt). The script is working as expected, but the issue is there is special character shown as question mark on result file (see figure below).
Here is the script :
RES_FILE=result.txt
for i in `cat list.txt`; do echo "############ "$i" ############"; grep $i source.txt; echo ""; done > "$RES_FILE"
echo "DONE"
The file name looks like this :
-rw-r--r-- 1 uatabp1 aimsys 4705499 Jan 19 13:52 source.txt
-rw-r--r-- 1 uatabp1 aimsys 40 Feb 17 14:19 list.txt
-rwxr-xr-x 1 uatabp1 aimsys 421 Feb 20 09:15 test.sh
-rw-r--r-- 1 uatabp1 aimsys 22629 Feb 20 09:34 result.txt??
Why it has question mark on result.txt?