Dr
Wed Sep 13 09:07:28 CDT 2006
JRS: In article <2E4BCC9B-527B-4EDA-A3B5-5AB2454AE3CA@microsoft.com>,
dated Sat, 9 Sep 2006 22:50:02 remote, seen in news:microsoft.public.scr
ipting.vbscript, David99x <David99x@discussions.microsoft.com> posted :
>On a Windows 98 machine I have space delimited files with a data string for
>each hour of the day. I want to use a vbscript to change the value in the
>4th
>column to 9999 when the time stamp in the 2nd column is 0300 as in the 3rd
>row here. I'm not a programmer.
Then don't use a programming language. Use a scripted text editor such
as MiniTrue (or use a programmer).
>JO 09030300 * 0.1378 * * * 82 * * * * * * 78 157 * * 5914
mtr -x+ *.txt ^(.{7}0300\D*)([\d\.]*) = "\1 9999"
will do it neatly. When you're satisfied that it is right, use the -n
option to kill prompts.
That takes start-of-line, 7 of any character, then 0300, then any non-
digit, as \1 ; then any string of digits and dots (which would be \2)
and replaces the characters by what is shown. You did not ask for the
two spaces, which maintain alignment.
You might prefer to specify the initial characters more exactly, maybe
as \w\d\s\d{4} - letter digit whitespace four-digits.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:
http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
I find MiniTrue useful for viewing/searching/altering files, at a DOS prompt;
free, DOS/Win/UNIX, <URL:
http://www.idiotsdelight.net/minitrue/>