![]() |
![]() |
#1 |
Sep 2002
Database er0rr
22·5·181 Posts |
![]()
Under Windows, I have a log file which has, for example, the last line:
10000000000+99905361 is 5-prp I want to use this to start the program again with parameter "-s99905361". Please help. ![]() |
![]() |
![]() |
![]() |
#2 |
"William"
May 2003
New Haven
3·787 Posts |
![]()
What tools are permitted? I'd probably use PERL to write a batch file, and then wrap that in another batch file that calls the PERL then calls the PERL-created batch file. A port of the UNIX tool "tail" would also be handy. If it must be stock Windows, it might be possible to cook something up with a batch file named 10000000000 and the find command, but that would take some playing around to make it work.
|
![]() |
![]() |
![]() |
#3 |
Sep 2002
Database er0rr
362010 Posts |
![]()
Windows without Perl, I am affraid. I am pretty sure there is a way, by scanning the log file and storing each line into a variable so that when the file has been read the variable will contain the last line. Then it is a question of parsing the contents of the variable. But the details escape me
![]() |
![]() |
![]() |
![]() |
#4 |
Jun 2003
22×61 Posts |
![]()
Are you able to install cygwin? If so you can use the standard linux tools to accomplish this.
|
![]() |
![]() |
![]() |
#5 |
Jun 2003
22×61 Posts |
![]()
Are you able to install cygwin? If so you can use the standard linux tools to accomplish this. Or you can always write up a C program to do this.
|
![]() |
![]() |
![]() |
#6 |
Jan 2005
Caught in a sieve
6138 Posts |
![]()
I don't see you getting away with this from a batch file without at least sed. Maybe tail, too, if you can find it.
Alternativley, some VBScript might do it for you. I know you can parse a line with a RegExp, and start a program with "SystemUtil.Run", but I don't know how to open a file in VBScript. Edit: Here's how. Last fiddled with by Ken_g6 on 2006-12-07 at 15:26 |
![]() |
![]() |
![]() |
#7 | |
"William"
May 2003
New Haven
3·787 Posts |
![]() Quote:
It's possible that recent versions of Windows include a command that will read input, but I don't know of any. The best I've been able to concoct uses three key ideas: 1. Using findstr to get a prefix on the line which is shell executable 2. Using variable string substitution to replace the embedded "-" with a blank 3. Redirecting output to files with the file extension ".bat" so that you can then treat the output as a shell script. The steps are: 1. make a copy of the log with the name "Call A.". Include the blank and have the file extension be blank. 2. create filelist.txt with the single line "Call A ". No quotes in the file, but be sure the blank is after the A. 3. findstr /Fflist.txt "PSP" > b.bat This creates a file where every line begins Call A, 4. Create a file named a.bat that has echo off set X = %1 echo d %X:-= % > c.bat every time this runs, it overwites c.bat with a line that has d then two tokens parsed from the first token 5. Create a file named d.bat that has ProgramName -s%2 6. After the findstr, use "Call b.bat" 7. After the b.bat, "Call c.bat" This can be cleaned up in a few ways - some of the batch files can be replaced with calls to CMD, or some of the batch files can be combined with labels and flags. And of course it's MUCH cleaner to copy off the internet a sed and tail program that work in windows. Last fiddled with by wblipp on 2006-12-07 at 17:38 Reason: typo |
|
![]() |
![]() |
![]() |
#8 |
6809 > 6502
"""""""""""""""""""
Aug 2003
101×103 Posts
251316 Posts |
![]() |
![]() |
![]() |
![]() |
#9 | |
Sep 2002
Database er0rr
22·5·181 Posts |
![]() Quote:
It is beginning to look like I will need some extra-windows program, but I am studying William's solution... Also, I will revise some DOS programming, hoping that this will still work in XP. |
|
![]() |
![]() |
![]() |
#10 |
6809 > 6502
"""""""""""""""""""
Aug 2003
101×103 Posts
9,491 Posts |
![]()
If we were still in Win3, we could use recorder. But a .vbs could do it.
Use it to fire up Note/WordPad. Ctrl-end to the bottom of the file, move right, highlight, ctrl-c, etc. You can even use it to launch your app. See this link: http://msdn2.microsoft.com/en-us/library/8c6yea83.aspx |
![]() |
![]() |
![]() |
#11 |
"Sander"
Oct 2002
52.345322,5.52471
29·41 Posts |
![]()
I was going to suggest edlin, but i can't figure out how to use ^Z in a batch file.
Assuming you have a file with only the prp's in it (findstr prp out.txt > prp.txt) edlin prp.txt 1R10000000000+^Zprogram -S 1R is 5-prp^Z e The ^Z is a CTRL-Z If i use a batch file it's always seen as a normal ^Z. There are windows versions of most unix commands online though |
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Windows command line | mu5tan6 | Software | 14 | 2015-03-20 17:21 |
Windows 7 Windows Update & Prime95 issue!!! | Unregistered | Information & Answers | 14 | 2010-04-10 21:47 |
[Bug] Wrong parsing some results of manual testing | klajok | PrimeNet | 2 | 2008-12-17 18:11 |
MultiSieve from the command line (on Windows) | monst | Software | 7 | 2007-12-18 02:37 |
E=6 in P-1 result line | S485122 | Software | 4 | 2007-01-28 04:02 |