| View previous topic :: View next topic |
| Author |
Message |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Thu Aug 01, 2002 5:47 am Post subject: other code question |
|
|
i have just learned the dos can not stdout out right
what i mean is if i try this
tail -f cardout.dat <----- this works outputs it to the screen BUT
if i do this
tail -f cardout.dat | perl4 parse.pl /4 /olog.txf <---this won't work cuase dos can't pipe it out right ( when using the -f command whick i need)
any vds code that i can uses so i can fix this problem
thanks |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Aug 01, 2002 7:10 am Post subject: |
|
|
For DOS output to a file, use:
> (overwrites/creates the destination file)
>> (appends to the destination file)
Example:
dir/s > test.dat
dir/s >> test.dat
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Thu Aug 01, 2002 2:03 pm Post subject: right |
|
|
but i need the tail -f so that it will watch the file as it grows, and it will feed the data TO the perl script if i just have it save to a file then the perl script will stop runing when it get to the end of the file this is what tail -f does it let's the data to be feed to the perl script " like a live feed"
hard to explain BUT does don't have a stdout like linux does. |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Aug 01, 2002 8:38 pm Post subject: |
|
|
I'm not familiar with the program and don't understand exactly
what you want to do. However, if the DOS command:
tail -f cardout.dat
prints the correct results to screen, the following will print the
same results to output.txt (or any file name you choose):
tail -f cardout.dat > output.txt
If you need to continously add info to the file, you can use a
loop with ">>" like this:
tail -f cardout.dat >> output.txt
NOTE: In DOS, if you use a filename or command with spaces,
it may need to be enclosed in quotes.
If this still is not what you need, maybe you can try to explain
step by step (in more detail) what your program does, and what
you're trying to do. We'll need to know that before we can
come up with a solution in either DOS or VDS...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Thu Aug 01, 2002 11:05 pm Post subject: yes |
|
|
ok i know you are talking to say BUT the file option won't work also ( i tried it) what i need is a vds program that will do this:
take the output from tail -f and feed that output to the perl script,
the reason the >> won't work cause dos pipe command is lacking the Ability to DO a live feed and feed it to the perl script. the program that i run gathers data then i used the perl script to convert that data to english, well english for me that is. this must be done DURing live feed other wise the data would be repeated...that is why i uses tail -f it watchs the file as it grows, thus making it not repeat the info
hard to explain...
i hope i explain it better |
|
| Back to top |
|
 |
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Thu Aug 01, 2002 11:12 pm Post subject: |
|
|
How about launching the Perl script directly and modifying the Perl script to directly read
the data from an output file created by "tail" and to directly write the final output file? |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Thu Aug 01, 2002 11:51 pm Post subject: hummm |
|
|
that might work, but i have alot of option that are in the perl script which can make it hard to run the Perl script directly. some of the option are:
#Useage:
#
# <logfile> \0 only new cmd82's and C9's data display
# <logfile> \1 all cmd82's and C9's data display
# <logfile> \2 all cmd82's and C9's packet and data display
# <logfile> \3 all parsed packets display
# <logfile> \4 all cmd82's and c9's in all INS40
# <logfile> \5 all cmd82's and c9's fully disassembled
also reading the ouput directly can cause problems like :
one when the program is waiting to get data before it can write in this case the perl script would stop.. beacuse it would think its at the end of the file this is why tail -f comes to play |
|
| Back to top |
|
 |
iMPA Newbie
Joined: 26 May 2001 Posts: 9 Location: Spain
|
Posted: Fri Aug 02, 2002 12:48 am Post subject: |
|
|
what about a DOS batch file, first run the tail program and then the perl script...
| Code: |
tail -f cardout.dat > output.txt
perl4 parse.pl /4 /output.txf
|
maybe  |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Fri Aug 02, 2002 1:22 am Post subject: but |
|
|
iMPA
i try that BUT this:
| Code: | tail -f cardout.dat > output.txt
perl4 parse.pl /4 /output.txf
|
it nevers goes to the second line BECASUSE the first line never Finishes...if you follow what i mean.... |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Fri Aug 02, 2002 1:43 am Post subject: |
|
|
I don't really know what "tail" does..or anything about perl for that matter but, you might try something along the lines of repeatedly running tail -f cardout.dat with the perl script open.
| Code: |
:evloop
%%Num = 0
repeat
RUN tail -f cardout.dat
if @EQUAL(%%Num,0)
RUN perl4 parse.pl /4 /output.txf
%%Num = @SUCC(%%Num)
end
%%Event = @event()
wait 0.1
until %%Event
goto %%Event
|
Just a shot in the dark here though.. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Fri Aug 02, 2002 2:11 am Post subject: hummmm |
|
|
SnarlingSheep
what tail -f does is this :
"monitors a file as it grows. Every two seconds, tail wakes up and displays any new data at the end of the file. This flag is ignored if reading from the standard input and standard input is a pipe."
so what i need is a way to have vds take the tail -f cardout.txt - this is display in a dos window and feed this info into perl.. now i see that in your script you have this:
| Code: | | run perl4 parse.pl /4 /output.txf |
i need to pipe ( | ) the output of the vds to perl
if i was to run what you have i would get a error in perl becuase of the following
1. NO input file is specifed or beacuse THERE is nothing being pipe to the perl script |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Fri Aug 02, 2002 4:13 pm Post subject: hummm |
|
|
anyone have any other ideas  |
|
| Back to top |
|
 |
iMPA Newbie
Joined: 26 May 2001 Posts: 9 Location: Spain
|
Posted: Fri Aug 02, 2002 4:51 pm Post subject: |
|
|
Maybe using the vdsconsole.dll?
It provides Visual DialogScript the ability to provide communication between a console application and their script.
good luck !! _________________ share what you know, learn what you don't |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Fri Aug 02, 2002 4:56 pm Post subject: hummmm |
|
|
| is that dll freeware? |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Fri Aug 02, 2002 5:06 pm Post subject: |
|
|
| If you want to know if a dll is freeware or not, search for it on vdsworld... If there isn't a Price: label it's free... |
|
| Back to top |
|
 |
|