Hi,
I have a fixed length text file that needs to be cut into individual files in aix and facing padding issues. If I have multiple blank spaces in the file it is just making it one while cutting the files..
Eg:-
$ - blank space
filename:file.txt
1234_A001Chris$$$$Professor$$CompuerScience
1234_A002Jhon$$$$Professor$$BilogicalSciences
Desired Output
filename:- 1234_A.txt
001Chris$$$$Professor$$CompuerScience
002Jhon$$$$Professor$$BilogicalSciences
As per the below code, I am getting the output with just 1 blank space no matter I have any number of blank spaces in the actual file.
while read LINE; do
echo $LINE | cut -c7- >> $(echo $LINE | cut -c1-6).txt
done < file.txt
current output:-
001Chris$Professor$CompuerScience
002Jhon$Professor$BilogicalSciences
Desired Output
filename:- 1234_A.txt
001Chris$$$$Professor$$CompuerScience
002Jhon$$$$Professor$$BilogicalSciences
Please give your ideas..
Thx