RE: How can I figure out whether it is binary file or ASCII file under one directory?

2002-10-17 Thread Carl Jolley
On Thu, 10 Oct 2002 [EMAIL PROTECTED] wrote:

 Like .bin, .exe files, The format of the file is binary instead of ASCII.

 Thanks

 Lixin

 -Original Message-
 From: Stovall, Adrian M. [mailto:Adrian.Stovall;durez.com]
 Sent: Thursday, October 10, 2002 2:06 PM
 To: [EMAIL PROTECTED]
 Subject: RE: How can I figure out whether it is binary file or ASCII
 file under one directory?


 Can you be any more specific than various binary files?

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:Cai_Lixin;emc.com]
 Sent: Thursday, October 10, 2002 12:54 PM
 To: [EMAIL PROTECTED];
 [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Subject: How can I figure out whether it is binary file or ASCII file
 under one directory?


 Dear all,

 A question, How can I figure out whether it is binary file or ASCII file
 under one directory using perl? Does perl have a function for that? I
 have a project to pick up various binary files from some directories.


The file test operators that I nebtioned previously can sometimes cause
confusion. For example, it is entirely possible that a .pdf file can
consist of nothing but ascii text characters however that doesn't mean
that trying to print it out with NotePad will look very pretty. The use of
the -T operator should not be relied on if the file's extention tells you
something else.

 [EMAIL PROTECTED] Carl Jolley
 All opinions are my own and not necessarily those of my employer 

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Regexp needed

2002-10-17 Thread Carl Jolley
On Mon, 14 Oct 2002 [EMAIL PROTECTED] wrote:

 Hi, i have a file like this:
 .
 p167   bt1sqtf4 2720  1055adelevin  2002-10-14 11:21
 p130   bt1sqtf4 1753  520 aginer2002-10-14 10:33
 p143   bt1sqtf4 1658  518 alchippe  2002-10-14 10:30
 p144   bt1sqtf4 1777  663 amaragou  2002-10-14 10:33
 p175   bt1sqtf4 2976  1148ascatola  2002-10-14 11:30
 p176   bt1sqtf4 3039  1164bceillie  2002-10-14 11:36
 p135   bt1sqtf4 1224  503 blegrand  2002-10-14 10:07
 p122   bt1sqtf4 4692  616 CAPTMA1   2002-10-14 09:53
 p163   bt1sqtf4 2577  813 cfrancoi  2002-10-14 11:14
 p154   bt1sqtf4 2200  914 chtuffre  2002-10-14 10:54
 p146   bt1sqtf4 1848  589 cky   2002-10-14 10:35
 p116   bt1sqtf4 4476  581 cvanlath  2002-10-14 09:42
 ..

 How can i extract the 5 parameter ie the PID and put all in a an array?
 Thanks for your precious help.


I would code it like:

while(FILE) {
  push(@pid,(split(/\s+/,$_))[4]);
}

 [EMAIL PROTECTED] Carl Jolley
 All opinions are my own and not necessarily those of my employer 


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs