Rename a file
Hi, Is there any inbuilt command by which we can rename a file (in WinNT) Regards, Chinku __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to delete a file from the file system
Hi, Is there any module which has methods that can be used to delete a file from the filesystem in the windows NT environment. Thanks in Advance Chinku __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Error while using Bulkmail module
Hi, I am using Mail::Bulkmail module version 3.09 for mail functionality in one of my scripts. The script generates and sends around 4000 mails in a span of 3 hours and at the end of the script there is one last summary mail being sent. But at this point, the Bulkmail generates an error saying "Deep Recursion on subroutine Mail::Bulkmail::_process_string at PerlApp/Mail/Bulkmail.pm line 1761 line 5" I am running the script as an executable generated using PerlApp from Active State. Please do advice if you have an idea as to why this is happening. Thanks in Advance Chinku __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How do you find out the size of a file
Hi, I have a requirement to find out the size of a file existing in an NTFS file system. Are there any suitable modules that can be used? Thanks in advance Chinku __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem in Mail::Bulkmail 3.09 module
Hi, I have a perl program which uses the Mail::Bulkmail v3.09 module to send out mails. The SMTP server we have is the lotus notes server. However, the number of mails that are being sent is pretty huge -- around 2000 mails in a span of 30 minutes. The perl program crashes after sending around 700 mails with the Bulk mail error log giving the following error. error: Could not make socket for 10.10.54.160, Socket error (Too many open files) code : MBS002 error: Could not make socket for 10.10.54.160, Socket error (Too many open files) code : MBS002 error: Could not make socket for 10.10.54.160, Socket error (Too many open files) code : MBS002 error: Could not make socket for 10.10.54.160, Socket error (Too many open files) code : MBS002 error: Could not make socket for 10.10.54.160, Socket error (Too many open files) code : MBS002 Please let me know if anyone has come across the same situation and if so please advice as to what a good solution to this would be. Thanks Chinku __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with the Perl System command
Hi, I am facing an issue with the perl system command The relevant lines of code are the following: chdir "$util"; my @args = ("ldapmodify", "-D \"cn=$bdn\"", "-w $bp", "-h $svr", "-f \"$ldif\"", "-c", "-a"); system(@args) == 0 or die "system @args failed: $?"; The system call amounts to the following string: system ldapmodify -D "cn=Directory Manager" -w infosys123 -h j-tdir1 -f d:\Netscape\Server4\slapd-j-cdcsm08\logs\modifications.ldif -c -a It gives me the following error d:\Netscape\Server4\slapd-j-cdcsm08\logs\modifications.ldif: Invalid argument system ldapmodify -D "cn=Directory Manager" -w infosys123 -h j-tdir1 -f d:\Netscape\Server4\slapd-j-cdcsm08\logs\modifications.ldif -c -a failed: 22784 at pwdmanagervss.pl line 407. However, the ldapmodify command run from the command prompt works perfectly. Thanks Chinku __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Regarding Mail::Bulkmail 3.09 module
Hi, I am facing a problem in using the Mail::Bulkmail 3.09 module. I am using the following method to specify the configuration files. Mail::Bulkmail->conf_files('C:/Perl/lib/Bulkmail.cfg'); and I have converted the script to an '.exe ' file. While I run the .exe file I get the error "Can't call method "header" on an undefined value at notessyncv6.pl line 825, line 82." The script runs fine when it is run as a ".pl" file Thanks Chinku __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Help needed on File manipulation
Hi, I am writing a Perl program that reads files created by another independent process. I have to take care that the perl program does not read the files that are in the process of getting created. I am programming in Windows NT environment. It is also not possible for the perl program to get triggered by the other process that creates the files. Is there any method by which it can detected whether the file is already in use by the another process -- any modules or commands (already tried open command). The file open function in perl returns an error if the file is already in use. But is there some better way to do this? Thanks __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help required.....about string/text manipulation
Hi, I wud like some help in assembling the kit. Thanks in Advance --- Rob Dixon <[EMAIL PROTECTED]> wrote: > Mohit_jain01 wrote: > > > > > From: Rob Dixon > > > > > > Mohit_jain01 wrote: > > > > > > > > I am facing a problem with text file manipulation with Perl. > > > > > > > > I have a file with over 2 lac lines of data. > > > > I need to find the duplicates(strings) in the file and copy those records into > > > > another > file. > > > > > > > > Is there a function/module in Perl by which I can read the duplicates in a > > > > file at one go > and print them > > > > on to another file. > > > > > > Before we can help you we need to know a little more of your problem. > > > > > > Are you looking for duplicate lines in the file, or duplicate strings defined > > > in some other way? How big is the file you want to read (how many lines > > > or strings do you want to compare)? > > > > > > There are modules which will help you write your program, but exactly > > > how you go about it depends on the details of your problem. > > > > I have a big file containing about 20 lines. This file basically contains some > > records. A > sample of the file is as given > > below: > > > > dn: cn=1148734,ou=Employees,dc=jci,dc=com > > > > displayname: Herek, Moriah L > > > > jdirlastfourssn: 2888 > > > > dn: cn=1148735,ou=Employees,dc=jci,dc=com > > > > displayname: Pelletier, Michael J > > > > jdirlastfourssn: 8719 > > > > uid: cpellem > > > [snip data] > > > > What I need to do is: > > > > 1. Take the first entry and get the value of the display name and jdirlastfourssn > > attribute. > > > > 2. Check whether there is another record with the same display name attribute > > value. > >(There cud be multiple records) > > > > 3. If so then extract both record and write them into another file. > > > > 4. Delete these duplicate records from the parent file. > > > > 5. Do that for all records. > > > > I'm not clear whether you mean 200K lines or 200K records (which seem to be mostly > 6 lines each except for 'Pelletier, Michael J' which has an additional pair of > lines for a 'uid' value. But, even if it were 200K records at about 100 characters > each this would be 20Mb, which is well within the capacity of all but the smallest > computers these days. This problem is far easier with all the data in memory, so > I'll go that way, and if you find it's not working or is too slow we'll think again. > > OK, so let me rewrite your algorithm a little. > > - Read all records into memory > - While there are records left > - calculate a 'key' from the display name and serial number > - find all records in the data with a matching key > - if there was only one then print it to parent file, else print them to file 2 > - delete them from the list > > From the top: > > > "Read in all of the records" > > It looks like all the information starts with a line beginning with 'dn:'. If this > is wrong we'll have to change it. > > my @records; > > while () { > push @records, '' if /^dn:\s+/; > $records[-1] .= $_; > } > > > Before the loop, how about a subroutine which, given one of the multi-line records, > will return a key value containing the name and serial number. This picks out the > strings and concatenates them with a tab character in between, chosen because it > is unlikely to appear in the data itself. > > sub keyval { > my $rec = shift; > my ($name, $sn); > ($name) = $rec =~ m/^displayname:\s+(.+)/m; > ($sn) = $rec =~ m/^jdirlastfourssn:\s+(\d+)/m; > join "\t", $name, $sn; > } > > > "While there are records left" Here's the loop, including a couple of lines to > remove all non-blank entries from the beginning which will be left by the call > to 'delete' that you see in a moment. > > while (@records) { > until (exists $records[0]) { > shift @records; > } > : > } > > > "Calculate a 'key' from the display name and serial number" > > my $key = keyval($records[0]); > > "Find all records in the data with a matching key" This call to 'map' > returns a list of indices of all the records in the array which have > a matching key value. This is bound to include the index zero as the > first record matches itself. If there are more then the length of the > array will be more than 1. > > my $i = 0; > my @slice = map { > my @i = $i++; > defined $_ and keyval($_) eq $key ? @i : () > } @records; > > > The next two steps together: "If there was only one then print it to > parent file, else print them to file 2. Delete them from the list" > The 'delete' function usefully returns a list of all the records > it deleted, so we can just print the results of deleting the array > slice. > > if (@slice == 1) { > print PARENT delete @[EMAIL PROTECTED]; > } > else { > print FILE2 delete @[EMAIL PROTECTED]; > } > > > And you're done. Clearly you need to open filehandles DATA for read > and PARENT and FILE2 for write, but
help needed on text file/String manipulation
Hi, I am facing a problem with text file manipulation with Perl. I have a file with over 2 lac lines of data. I need to find the duplicates(strings) in the file and copy those records into another file. Is there a function/module in Perl by which I can read the duplicates in a file at one go and print them on to another file. The following is a more detailed form of my requirement: The input to the code is a text file with the following format of records. dn: cn=1148734,ou=Employees,dc=jci,dc=com displayname: Herek, Moriah L jdirlastfourssn: 2888 dn: cn=1148735,ou=Employees,dc=jci,dc=com displayname: Pelletier, Michael J jdirlastfourssn: 8719 uid: cpellem dn: cn=1148736,ou=Employees,dc=jci,dc=com displayname: Manimanakis, Aris N jdirlastfourssn: 0366 dn: cn=1148738,ou=Employees,dc=jci,dc=com displayname: Bernardini, James A jdirlastfourssn: 8540 dn: cn=1148739,ou=Employees,dc=jci,dc=com displayname: Steyvers, Robert L jdirlastfourssn: 8634 dn: cn=1148740,ou=Employees,dc=jci,dc=com displayname: Vest, Elizabeth G jdirlastfourssn: 7487 The file will look like the above. What I need to do is: 1. Take the first entry and get the value of the display name attribute. 2. Check whether there is another record with the same display name attribute value.(There cud be multiple records) 3. If so then extract both record and write them into another file. 4. Delete these duplicate records from the parent file. 5. Do that for all records I hope you got what I meant. __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]