0

I have about 30-50 text files monthly with all different names located in folder /Balance_Text_Files. I need to rename all these files with part of the first line from within each file. I am not real familiar with batch files if someone could please help me?

Example:

File name QSYSPRT439456.txt

within this file on the first line is:

MX893                 PHYSICIAN XYZ                  2 1 0 - 1 6 5 4 2              PAGE 1

Each file has a different string after PHYSICIAN XYZ and that is what the file would need to be renamed to.

So, QSYSPRT439456.txt would be renamed 210.16542.txt

Any help would be greatly appreciated, wasting so much time renaming these manually every week.

ooga
  • 15,118
  • 2
  • 19
  • 21
  • I tried to edit your question, but I think I may have screwed it up a little. E.g., is the `210-16542` double-spaced like that? – ooga May 13 '14 at 20:47
  • Maybe take a look here: http://stackoverflow.com/questions/17370879/renaming-file-based-on-its-content-using-batch-file or here: http://stackoverflow.com/questions/17366009/rename-file-based-on-file-content-batch-file ... the problem seems to be similar, with a major difference: The information you need is not a full line but inside a line with whitespaces apparently – smagnan May 13 '14 at 21:00
  • Do this value `2 1 0 - 1 6 5 4 2` ALWAYS have the same number of char ? – SachaDee May 13 '14 at 21:22
  • yes, that part does always have the same number of characters, and yes it is double spaced like that. – sueshe4me May 15 '14 at 16:30

0 Answers0