Re: files checksum perl program help
Thank You very much Jim for your immediate response. my requirement is that I have standard installation on server1 which is a master copy. I know the location of the installation directory which contains bunch of libraries. I have a another installation on Server2 for the same application. I do know the location of the installation dir. I have to compare all the libraries (checksums) on the server2 with the standard installation on server1, for all the files in the installation dir. I have to do dynamically compute the checksum of each file in the server2 and compare same with on server1. I am not sure which protocol suits best. right now I am considering NFS. Your help greatly appreciated. Regards, Ramp From: Jim Gibson jimsgib...@gmail.com To: beginners@perl.org beginners@perl.org Sent: Wednesday, January 4, 2012 3:54 PM Subject: Re: files checksum perl program help On 1/4/12 Wed Jan 4, 2012 3:38 PM, ram ram ram_p...@yahoo.com scribbled: Hi , Wish you a Very Happy and Wonderful New Year. I am a beginner in perl programming. I request your help to write a perl program that takes 2 different directories on 2 different servers and find all the files in these 2 directories have the same files with same checksums. can anybody help me on this? How are you going to access the files on the two servers? NFS? SMB? FTP? SCP? What kind of checksum do you want to use? Are the checksums already computed, or do you need to compute them yourself? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: files checksum perl program help
On 1/5/12 Thu Jan 5, 2012 11:01 AM, ram ram ram_p...@yahoo.com scribbled: Thank You very much Jim for your immediate response. my requirement is that I have standard installation on server1 which is a master copy. I know the location of the installation directory which contains bunch of libraries. I have a another installation on Server2 for the same application. I do know the location of the installation dir. I have to compare all the libraries (checksums) on the server2 with the standard installation on server1, for all the files in the installation dir. I have to do dynamically compute the checksum of each file in the server2 and compare same with on server1. I am not sure which protocol suits best. right now I am considering NFS. Your help greatly appreciated. (Please do not top post on this list. If you do not know what this means, please ask or look at http://en.wikipedia.org/wiki/Posting_style. Thanks.) Using NFS (or SMB) will allow you to treat the files as if they are local. Using SCP or FTP means that you will have to fetch the files first before they can be compared. Why do you need to compute checksums? If you are just trying to see if two files are the same, you can compare them. For example, the Unix cmp program will do that. The File::Compare module provides a Perl equivalent. Checksums will be useful if generating and saving them allow you to avoid comparing long files more than once. But if you are not in control of the library files on the two servers, then you can't be sure a file has changed, and you will have to read it again. Checksums would also be useful if you had more than two servers to compare. You could compute the checksums once and then make multiple comparisons of the various checksums instead of comparing the files themselves. However, if all you are doing is comparing the same file on two different servers, computing the checksums doesn't buy you a lot. You still have to read the whole file in order to compute a valid checksum. Whatever scheme you use, your goal should be to only read each file once. You might want to compare file sizes first. If two files are different sizes, then they are not exact copies, and you do not need to read the entire files. If two files are the same size, then they might be the same or they might be different, and you will have to compare the files (or checksums). If you do use NFS, then the details of fetching the files will be handled by the operating system. In that case, I would suggest the use of the File::Find module for finding the files on the two servers. How often do the files change? The answer may affect your choice of method. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: files checksum perl program help
Thank you for the details. the main task is that. On server1 , the master installation dir which contains around 100 shared library files (*.so) the server2 also has same number of shared libraries. But in this installation there might be some shared libraries older than master install or newer than master install. I need to figure out and report in a file that the library xxx_lib.so(server2) is different from Master(which is on server1). Ramp From: Jim Gibson jimsgib...@gmail.com To: beginners@perl.org beginners@perl.org Sent: Thursday, January 5, 2012 11:34 AM Subject: Re: files checksum perl program help On 1/5/12 Thu Jan 5, 2012 11:01 AM, ram ram ram_p...@yahoo.com scribbled: Thank You very much Jim for your immediate response. my requirement is that I have standard installation on server1 which is a master copy. I know the location of the installation directory which contains bunch of libraries. I have a another installation on Server2 for the same application. I do know the location of the installation dir. I have to compare all the libraries (checksums) on the server2 with the standard installation on server1, for all the files in the installation dir. I have to do dynamically compute the checksum of each file in the server2 and compare same with on server1. I am not sure which protocol suits best. right now I am considering NFS. Your help greatly appreciated. (Please do not top post on this list. If you do not know what this means, please ask or look at http://en.wikipedia.org/wiki/Posting_style. Thanks.) Using NFS (or SMB) will allow you to treat the files as if they are local. Using SCP or FTP means that you will have to fetch the files first before they can be compared. Why do you need to compute checksums? If you are just trying to see if two files are the same, you can compare them. For example, the Unix cmp program will do that. The File::Compare module provides a Perl equivalent. Checksums will be useful if generating and saving them allow you to avoid comparing long files more than once. But if you are not in control of the library files on the two servers, then you can't be sure a file has changed, and you will have to read it again. Checksums would also be useful if you had more than two servers to compare. You could compute the checksums once and then make multiple comparisons of the various checksums instead of comparing the files themselves. However, if all you are doing is comparing the same file on two different servers, computing the checksums doesn't buy you a lot. You still have to read the whole file in order to compute a valid checksum. Whatever scheme you use, your goal should be to only read each file once. You might want to compare file sizes first. If two files are different sizes, then they are not exact copies, and you do not need to read the entire files. If two files are the same size, then they might be the same or they might be different, and you will have to compare the files (or checksums). If you do use NFS, then the details of fetching the files will be handled by the operating system. In that case, I would suggest the use of the File::Find module for finding the files on the two servers. How often do the files change? The answer may affect your choice of method. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
files checksum perl program help
Hi , Wish you a Very Happy and Wonderful New Year. I am a beginner in perl programming. I request your help to write a perl program that takes 2 different directories on 2 different servers and find all the files in these 2 directories have the same files with same checksums. can anybody help me on this? Regards, Ramp
Re: files checksum perl program help
On 1/4/12 Wed Jan 4, 2012 3:38 PM, ram ram ram_p...@yahoo.com scribbled: Hi , Wish you a Very Happy and Wonderful New Year. I am a beginner in perl programming. I request your help to write a perl program that takes 2 different directories on 2 different servers and find all the files in these 2 directories have the same files with same checksums. can anybody help me on this? How are you going to access the files on the two servers? NFS? SMB? FTP? SCP? What kind of checksum do you want to use? Are the checksums already computed, or do you need to compute them yourself? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Executable perl program help!!
How can i generate such a file? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Executable perl program help!!
[EMAIL PROTECTED] wrote: How can i generate such a file? Million dollar question , No perfect answer. Depends on what OS you are using. Do a google on perl2exe For starters try the O.pm. To convert your perlcode to C and then compile the C code On linux You can compile using export LDOPTS=`perl -MExtUtils::Embed -e ldopts` export CCOPTS=`perl -MExtUtils::Embed -e ccopts` perl -MO=C script.pl script.c gcc $CCOPTS script.c -o script $LDOPTS This works only on some scripts. The O.pm is still evolving Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Executable perl program help!!
Rich Parker wrote: I was at Active State the other day, they have one that can be purchased. I have seen a few others when I did a similar search as mentioned. I haven't seen one for free or one that has a demo for it, I'd love to try one, if anyone sees one, let everyone know about it. You can download a demo version of ActiveState's Perl Dev Kit: http://www.activestate.com/Products/Download/Register.plex?id=PerlDevKita= e -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Executable perl program help!!
Also try http://www.indigostar.com/ Laurent coudeur Bob Showalter [EMAIL PROTECTED] 20/08/2003 16:20 To: 'Rich Parker' [EMAIL PROTECTED], [EMAIL PROTECTED] cc: Subject:RE: Executable perl program help!! Rich Parker wrote: I was at Active State the other day, they have one that can be purchased. I have seen a few others when I did a similar search as mentioned. I haven't seen one for free or one that has a demo for it, I'd love to try one, if anyone sees one, let everyone know about it. You can download a demo version of ActiveState's Perl Dev Kit: http://www.activestate.com/Products/Download/Register.plex?id=PerlDevKita= e -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Executable perl program help!!
How can i generate such a file? # vi mysript.pl : #!/usr/bin/perl -w use strict; print hello\n; # ./myscript.pl Bash: Bad command or file name : Permission denied # chmod 755 myscript.pl # ./myscript.pl hello # On unix it has to be executable by the user running it, commonly 755 or on winders you have to have the file extension .pl associated with the perl binary which is usually done on installing Perl. HTH DMuey -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Executable perl program help!!
[EMAIL PROTECTED] wrote: Also try http://www.indigostar.com/ Laurent coudeur Quick question about this, sounds great. But if I were running my Perl from an http call (Normal browser usage), what would the exec cgi call Look like, syntax wise?? Thanks. Bob Showalter [EMAIL PROTECTED] 20/08/2003 16:20 To: 'Rich Parker' [EMAIL PROTECTED], [EMAIL PROTECTED] cc: Subject:RE: Executable perl program help!! Rich Parker wrote: I was at Active State the other day, they have one that can be purchased. I have seen a few others when I did a similar search as mentioned. I haven't seen one for free or one that has a demo for it, I'd love to try one, if anyone sees one, let everyone know about it. You can download a demo version of ActiveState's Perl Dev Kit: http://www.activestate.com/Products/Download/Register.plex?id=PerlDevKita= e -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Executable perl program help!!
You may also want to look at the PAR module. It can create and executable, and it is available from ActiveState via ppm. Be aware that it packages the interpreter and modules with the script, so the executable can be very large, particularly with Tk. Another project I have heard good things about is tinyperl. I have been told that it give you executable perl on a floppy. I believe it is on Source Forge. --Rick - Original Message - From: Dan Muey [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, August 20, 2003 10:06 AM Subject: RE: Executable perl program help!! How can i generate such a file? # vi mysript.pl : #!/usr/bin/perl -w use strict; print hello\n; # ./myscript.pl Bash: Bad command or file name : Permission denied # chmod 755 myscript.pl # ./myscript.pl hello # On unix it has to be executable by the user running it, commonly 755 or on winders you have to have the file extension .pl associated with the perl binary which is usually done on installing Perl. HTH DMuey -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: PERL PROGRAM HELP!
At 11:35 20.06.2001 +0100, Govinderjit Dhinsa wrote: Iv been givin this program to modify, but I can not astblish what some parts of the program are doing. From printf to } Can any body help please and run through it with me pls! open iscd,$ARGV[0] or die Cannot open $ARGV[0],$!; this opens a file that's been typed in at the command line open sortcode,$ARGV[1]; this opens the second file that's been typed in at the command line while($line=iscd){ chomp $line; @fields=split \t,$line; this grabs one line at a time from the first file and splits it out into an array -- the line is apparently a tab delimited list printf sortcode \n%6.6s%8.8s%3.3s%27.27s%20.20s%35.35s%35.35s%10.10s%1.1s%1.1s%2.2s%2.2s%2. 2s%2.2s%2.2s%2.2s%2.2s%2.2s%2.2s%2.2s%1.1s%1.1s%6.6s%35.35s%4.4s%4.4s%10.10s %8.8s, $fields[0],$fields[1],$fields[2],$fields[4],$fields[5],$fields[6],$fields[7] ,$fields[11],$fields[14],$fields[25], $fields[26],$fields[27],$fields[28],$fields[29],$fields[30],$fields[31],$fie lds[32],$fields[33], $fields[34],$fields[35],$fields[58],$fields[60],$fields[61],$fields[64], $fields[76],$fields[77],$fields[78],$fields[79]; } this formats the data from the line and prints it out to the second file. There's probably a cleaner and easier-to-read way to do this. However, if you look at the docs for printf, and compare the input and output files you should be able to figure out exactly how the lines are getting formatted and printed. Aaron Craig Programming iSoftitler.com
RE: PERL PROGRAM HELP!
Hi, I am new to perl and have been chucked in the deep end!!! I have been asked to write a perl script, with a output in report style; Description for script: Read a file, (sorted) take certain data from the file, (problem) put the certain data in to fields.(problem) The big problem being that the File is not sorted in any form, e.g. no existing columns or fields or Headings! What I need to get from the file are: ID NUMBER, BranchNAME, ADDRESS. The file contains the above 3 data types and about another 5, which I need to get rid off! Can any body please suggest how do this task or what I need to read up on (topics e.g. Report writing etc) or any other tutorials on report writing or, any thing to show me how to get certain data from a file please Any help would be appreciated as I only have two days to this in!!! Somebody please help!
Re: PERL PROGRAM HELP!
Hi, I am new to perl and have been chucked in the deep end!!! I have been asked to write a perl script, with a output in report style; Description for script: Read a file, (sorted) take certain data from the file, (problem) put the certain data in to fields.(problem) The big problem being that the File is not sorted in any form, e.g. no existing columns or fields or Headings! What I need to get from the file are: ID NUMBER, BranchNAME, ADDRESS. The file contains the above 3 data types and about another 5, which I need to get rid off! Can any body please suggest how do this task or what I need to read up on (topics e.g. Report writing etc) or any other tutorials on report writing or, any thing to show me how to get certain data from a file please Any help would be appreciated as I only have two days to this in!!! Post an example of the input, 10-20 lines or so. Also, state roughly how many lines there will be in an input file. Reading the file, pulling data out, and structuring the data you've pulled out, will probably be relatively easy based on your brief description. The output might be real simple, or might be tricky, depending on what's needed. So, post a better idea of what output is needed. If the output is going to be pretty short and/or only used a couple times, it might be best to just keep the output format extremely simple. Otherwise, if you can dump the output into some other software that's good at taking structured data and doing report layouts of the sort you need, then maybe use that. Otherwise, if the output is going to be many pages long, and you want fairly simple report style pagination and formatting, then you *might* want to use perl's 'format' features. To read up on the latter, type the following at a shell prompt: perldoc perlform
RE: PERL PROGRAM HELP!
This code is a mess, your better off rewriting it. open iscd,$ARGV[0] or die Cannot open $ARGV[0],$!; open sortcode,$ARGV[1]; while($line=iscd){ chomp $line; @fields=split \t,$line; printf sortcode \n%6.6s%8.8s%3.3s%27.27s%20.20s%35.35s%35.35s%10.10s%1.1s%1.1 s%2.2s%2.2s%2. 2s%2.2s%2.2s%2.2s%2.2s%2.2s%2.2s%2.2s%1.1s%1.1s%6.6s%35.35s%4. 4s%4.4s%10.10s %8.8s, $fields[0],$fields[1],$fields[2],$fields[4],$fields[5],$fields [6],$fields[7] ,$fields[11],$fields[14],$fields[25], $fields[26],$fields[27],$fields[28],$fields[29],$fields[30],$f ields[31],$fie lds[32],$fields[33], $fields[34],$fields[35],$fields[58],$fields[60],$fields[61],$f ields[64], $fields[76],$fields[77],$fields[78],$fields[79]; } close iscd; close sortcode; exit; [End of file]
Re: PERL PROGRAM HELP!
Hello there, without some specifics, such as example input and required output there's not a lot we can do here. However, for ideas on how to extract the required data, look at using regex (regular expressions) by doing 'perldoc prelre'. For ideas on formatting the report look at perl formatting by doing 'perldoc perlform'. If you need more help, give us some more to go on. Gary On Wednesday 20 June 2001 12:45 pm, Govinderjit Dhinsa wrote: Hi, I am new to perl and have been chucked in the deep end!!! I have been asked to write a perl script, with a output in report style; Description for script: Read a file, (sorted) take certain data from the file, (problem) put the certain data in to fields.(problem) The big problem being that the File is not sorted in any form, e.g. no existing columns or fields or Headings! What I need to get from the file are: ID NUMBER, BranchNAME, ADDRESS. The file contains the above 3 data types and about another 5, which I need to get rid off! Can any body please suggest how do this task or what I need to read up on (topics e.g. Report writing etc) or any other tutorials on report writing or, any thing to show me how to get certain data from a file please Any help would be appreciated as I only have two days to this in!!! Somebody please help! -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000