date manipulation in text files

date manipulation in text files

3
NewbieNewbie
3

    May 25, 2006#1

    Am trying to change dates within hundreds of text files in a directory where the original date format is MM/DD/YYYY and the final desired format is YYYYMMDD. Seems hard to do without variables.

    Once I save this to a macro file, can someone suggest the syntax for running this on all files within the directory?

    Thanks for the help.

    6,683583
    Grand MasterGrand Master
    6,683583

      May 25, 2006#2

      A simple regular expression used with a Replace In Files does this job.

      UnixReOff
      ReplInFiles RegExp "directory with your files, i.e. C:\Temp" "file specification, i.e. *.*" "^([01][0-9]^)/^([0-3][0-9]^)/^([12][0-9][0-9][0-9]^)"
      "^3^1^2"

      That's it. If possible add some extra data into the search and replace string, for example double quotes if the date is surrounded by double quotes. Well, you can do this also with Search - Replace In Files instead of the macro because it contains one command. See help of UE about "Regular Expressions" and "Edit Macro" for a detailed description.

      Note: The replace string "^3^1^2" is on the next line below the ReplInFiles command. The help does not correctly describe that important fact.

      Add UnixReOn or PerlReOn (v12+ of UE) at the end of the macro if you do not use UltraEdit style regular expressions by default - see search configuration. Macro command UnixReOff sets the regular expression option to UltraEdit style.
      Best regards from an UC/UE/UES for Windows user from Austria