1.

Solve : Shell script to read a .DAT file & rename it?

Answer»

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.D 00000.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.SYS PRINT.DAT will look like ABCDEFGH.ABC2013.C0000.D133136.J11341.D 00001.SYSPR INT.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



Discussion

No Comment Found