Hi Friends,
Below is my requirement and i am not clear how to approach this issue in unix programming.
I have a folder with 2500 files. The files are in below format.
1234_name1.txt
1234_name123.txt
4567_name1.txt
4567_name123.txt
and i need a program which will read each file from this folder and read the first 4 bytes and move the file to the folder (if it does not exist create a new one) with the name of the file.
Example:
read 1234_name1.txt , extract 1234 and create a folder 1234. Move the file to the folder 1234.
read 1234_name123.txt, extract 1234 and now the folder exist, now simply move the file to the folder 1234.
Your views/suggestions are highly appreciated.
Thanks for your help in advance.
Regards,
Diwakar