Shell script to read a .DAT file & rename it
I need a batch script which can read a file *.D00000.DAT and find the specific line as below
*-*-* Job: 11676 Name: ABCDEFGH User: mfuser Date: 03/13/13 Time: 10:47:46 *-*-*
and store Job, Name, Date & Time in different variables.
Then do the following:
1. close the file.
2. Rename: keep the original file name & add the "Name" into it. Like below:
ABC2013.C0000.D133136.J11341.D00000.DAT after renaming it should be ABCDEFGH.ABC2013.C0000.D133136.J11341.D00000.DAT
3. Look for other files which has same Job and add the Name in that file name as well. Like below:
ABC2013.C0000.D133136.J11341.D00001.SYSPRINT.DAT will look like ABCDEFGH.ABC2013.C0000.D133136.J11341.D00001.SYSPRINT.DAT
3. Create a folder and name it with Name-Job-Date-Time
3. Move the renamed file into the folder
4. repeat the process for next *.D00000.DAT file