RE: counting lines in a text files

2005-06-23 Thread ericv
Hi again,
 
I am back with a test case in attachment
in the zip file you have:
* reprod.pl : the script. I need to get the line number for every line ( in 
fact that I filter with a regexp in the original script )
* TestObjMgr2.log: the data file read by reprod.pl
you will see that line 3,5,7,9 etc are empty lines but I need to count them
 
when you run the script, you will see that line 3.5.7,9 etc are not read ( 
skipped )
 
I tried:
* open the file in :raw mode   = no success
* set $/ = '\0'= no success
* reading the file and reset the line separator is not a good options, 
because I can handle thousands of
files with 800 000 lines each
* having \x0d\x0d\n or \x0d\n does not make a difference.
 
If you debug the script, you will see that the line 3,5,7 etc are ignored and  
not read 
 
Ideas ?
 
Thanks
 
Eric

-Original Message- 
From: $Bill Luebkert [mailto:[EMAIL PROTECTED] 
Sent: Thu 6/23/2005 11:25 AM 
To: ericv 
Cc: perl-win32-users@listserv.ActiveState.com 
Subject: Re: counting lines in a text files



Eric Vercelletto wrote:

 Hi folks,

 although the answer seems simple, I have a strange phenomenon while 
reading
 a text file, where I want to identify each
 line by its linenumber

 obviously first reflex is to use $.
 or at each iteration of foreach $line ( MYFILE)
   $linenumber++ ;

 this work in the majority of the lines

 but it seems some lines are not read by the foreach , and I suspect 
them to
 be lines only containing a \n
 I have also seen lines ending with \x0d\n but this does not seem to 
count
 for 2 lines though

 I will provide a test case during the day, but does anyone have an 
idea of
 what can happen ?

Should work fine.
Try reading the file and removing any \r or \n's from each line.
Then append a \n and write it back out to another file or console
with the line number prefixed for comparison to what the orig file
thinks is a line.  (\n should expand to a \r\n in text mode).

If you don't figure it out, post a short 10 line or whatever script
with a hunk of data that duplicates the problem.


--
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic 
http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)



___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Perl on Win32: any possibility to emule read_password

2005-05-25 Thread ericv
Hi folks,
 
the question is very simple: the function read_password does not work on Win 
32 platforms.
I have been searching for a solution everywhere i knew about, without success.
 
how could I achieve my goal, that is exactly to input a password without 
curious people to see
what is written ?
 
Thanks in advance
 
Eric

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Perl on Win32: any possibility to emule read_password

2005-05-25 Thread ericv
ok Bill,
 
I am talk about the function read_password which is part of the Term module.
It apparently works in all other platforms ( unix, etc...) but is know not to 
work on Win32 ( and i confirm that!)
 
I am working on a command line script, and need to input a password from the 
console, and obviously
i would avoid to show it explicitly.
 
Any ideas ?
 
Thanks

-Original Message- 
From: $Bill Luebkert [mailto:[EMAIL PROTECTED] 
Sent: Wed 5/25/2005 2:09 PM 
To: ericv 
Cc: perl-win32-users@listserv.ActiveState.com 
Subject: Re: Perl on Win32: any possibility to emule read_password



ericv wrote:
 Hi folks,
 
 the question is very simple: the function read_password does not 
work on Win 32 platforms.
 I have been searching for a solution everywhere i knew about, without 
success.
 
 how could I achieve my goal, that is exactly to input a password 
without curious people to see
 what is written ?

Guess what Eric, I have no idea what you're talking about.

What's read_password ?  Part of some of your code, maybe a function
in a Perl module, some C code maybe ?  Please be a little more explcit
since there are ways to accept input without echoing, we just need to
know what you're talking about - web page, commandline, GUI window ?

--
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic 
http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)



___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs