No announcement yet.

simple script to ignore last 19 characters of a line

  • Filter
  • Time
  • Show
Clear All
new posts

  • simple script to ignore last 19 characters of a line

    Can anyone help a newbie? ...I'm after a script to mark the last 19 alphanumeric characters in a line as unimportant.

    here is an example of the content:

    \\SERVER\Account Template.xls 28/02/2011 19:44:27 02/12/2006 06:34:05 03/10/2012 03:44:11

    I just want to ignore the last date, which will always be 19 chars long - however if there's an alternative script that's more efficient (something which starts ignoring from 3rd tab -> end of line) then please recommend that also.

    Many thanks.

  • #2

    You would need to add a grammar to your current File Format (or create a new File Format for this file extension), and use a regular expression to match on this Date. We have a guide for setting up grammars and unimportance here:

    Once it is set up in the interface as a default for these files, any scripted Rules-based comparison would also use the defaults (assuming the script runs as the same Windows User account as the graphical interface)

    The regular expression for ignoring the last 19 characters of every line would be:
    . = any character
    {19} = 19 of the "any character"
    $ = next to the end of the line

    If you need something more specific, a Regular Expression could be created to match a date at the end of the line:
    \d+/\d+/\d+ \d+:\d+:\d+$
    Aaron P Scooter Software