$ indicates blank space
file1.txt:
001_AHaris$$$$$020$$$$$$$$$
001_ATony$$$$$$030$$$$$$$$$
002_AChris$$$$$090$$$$$$$$$
002_ASmit$$$$$$060$$$$$$$$$
003_AJhon$$$$$$001$$$$$$$$$
$ indicates blank space
code
while read "LINE"; do
echo "$LINE" | cut -c6- >> $(echo "$LINE" | cut -c1-5).txt
done < file1.txt
current output as per the above code...
$ cat 001_A.txt
001_AHaris$$$$$020
001_ATony$$$$$$030
$ cat 002_A.txt
002_AChris$$$$$090
002_ASmit$$$$$$060
$ cat 003_A.txt
003_AJhon$$$$$$001
I am not getting the blank space in the individual files which are present at the end of the line but getting the spaces with in the line...please give your ideas to resolve this...
Desired Output:-
$ cat 001_A.txt
001_AHaris$$$$$020$$$$$$$$$
001_ATony$$$$$$030$$$$$$$$$
$ cat 002_A.txt
002_AChris$$$$$090$$$$$$$$$
002_ASmit$$$$$$060$$$$$$$$$
$ cat 003_A.txt
003_AJhon$$$$$$001$$$$$$$$$
Thanks