Greetings,
With help from this list (thank you), I have a Unix filter that adds 1 to a specific number in a text file, within a group of ads.
The line of text that changes:
ADNUM:

so the first ad looks includes this:
ADNUM: 1
second, ADNUM: 2
and so on.

The filter:

#!/usr/local/bin/perl -p
s/(ADNUM: )\d+/$1 . ++$x/ge;

Is it possible to make the ADNUM: the current date + a number and then add 1?
So each ad would have:
ADNUM: 322071
next would be: ADNUM: 322072
and so on.

I don't know where to start to make the date automatic, so I am changing the date manually.

I am very new at this... but I am trying.
My closest attempt is this:

#!/usr/local/bin/perl -p
$z = "32207";
s/(ADNUM: )\d+/$1+$z . ++$x/ge;

The number is changing as I desire, however, now "ADNUM:" does not appear (actually it is there at the start and the filter takes it away.)
So each ad has:
322071
second, 322072

What I am trying to do is give each ad a unique number to avoid confusion. Currently, if a file is done today and another file is done tomorrow, we end up with the same number for 2 different ads.

Thanks in advance for any help or advice.

Mike Freyberger
GA Press Association

--
------------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_script.shtml>
List archives: <http://www.listsearch.com/bbeditscripting.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to