10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
// Redhat
I have this code working, but need to add one more qualification so that I don't overwrite the files.
#!/bin/sh
cd /P2/log/cerner_prod/millennium/archive/
for f in *
do || continue #If this isn't a regular file, skip it.
&& continue #If a backup already... (2 Replies)
Discussion started by: Daniel Gate
2 Replies
2. Shell Programming and Scripting
Hi,
I have 32 files for which I want to check size of each file withe other file and if size is same then some action.
Any suggestion to write such script.
Logic:
have list of 32 files
using loop first compare size of one file with remaining 31 ,
do same iteration for each file with... (4 Replies)
Discussion started by: hemantakhandare
4 Replies
3. UNIX for Dummies Questions & Answers
Hello All,
I am running a script (power shell) from my desktop (Windows). The script needs to sftp a file(using PuTTY psftp.exe ) from my desktop to a server(UNIX server). Then, as a second step, the script needs to move (or copy and delete) this file from one directory on the server (UNIX server)... (3 Replies)
Discussion started by: scampi
3 Replies
4. Shell Programming and Scripting
I am pretty new to scripting, so I appreciate your advice in advance.
The problem:
100 directories each containing 2 files that have the same extension with random names. The only attribute that discriminates the files is size. I would like to write a script that compares the files for size... (6 Replies)
Discussion started by: JC_1
6 Replies
5. Shell Programming and Scripting
Dear all,
We are trying to get file information in a file from our sftp server with the program psftp.
lcd d:\sftpInfo
cd serverInfo
ls *.* > qqqqq.txt
After running the ls command, we see all files who are in the serverInfo directory on the screen. No error is showed.
Our question is:... (3 Replies)
Discussion started by: ton2204
3 Replies
6. Shell Programming and Scripting
Hello
i have file A created yesterday and file B created today
thanks to help create script compare between 2 files according to size
so if file B is less than 10% of file A i should have echo message with warning
also check if file B exist or not.
this should be run in loop for list of... (6 Replies)
Discussion started by: mogabr
6 Replies
7. Shell Programming and Scripting
hi,
i am new to this site.
i want to write a script to compare the file size of the files in the current dir with the files in the previous directory.
the files name will be same, but the filename format will be as xyzddddyymm.txt. the files will arrive with the month end date(i want to... (5 Replies)
Discussion started by: tweety
5 Replies
8. Shell Programming and Scripting
I have two file in a Directory.I want a script which will compare the Size of Two file.
Can Anyone Help me on this:
linasplg11:/opt/dataout/kk/linasplg11 # cat size
-rwxrwxrwx 1 root root 16658 Jan 8 13:58 lina_IP_SIP_1231325621210.xml
-rwxr-xr-x 1 root root 16672 Jan 8 14:30... (1 Reply)
Discussion started by: Aditya.Gurgaon
1 Replies
9. Shell Programming and Scripting
Hi guys,
firstly I'm working on SunOS 5.10 Generic_125100-10 sun4u sparc SUNW,Sun-Fire-V240
I've made a script to compress two directory and then send them to an other server via ftp. This is working very well.
Inside theis script I decide to log usefull data for troubleshooting in case of... (7 Replies)
Discussion started by: moustik
7 Replies
10. Shell Programming and Scripting
Is possible if I want to campare file size on source and destination after ftp transfer?
If anybody know, please explain to me. (1 Reply)
Discussion started by: icemania
1 Replies
Data::Compare::Plugins(3) User Contributed Perl Documentation Data::Compare::Plugins(3)
NAME
Data::Compare::Plugins - how to extend Data::Compare
DESCRIPTION
Data::Compare natively handles several built-in data types - scalars, references to scalars, references to arrays, references to hashes,
references to subroutines, compiled regular expressions, and globs. For objects, it tries to Do The Right Thing and compares the
underlying data type. However, this is not always what you want. This is especially true if you have complex objects which overload
stringification and/or numification.
Hence we allow for plugins.
FINDING PLUGINS
Data::Compare will try to load any module installed on your system under the various @INC/Data/Compare/Plugins/ directories. If there is a
problem loading any of them, an appropriate warning will be issued.
Because of how we find plugins, no plugins are available when running in "taint" mode.
WRITING PLUGINS
Internally, plugins are "require"d into Data::Compare. This means that they need to evaluate to true. We make use of that true value.
Where normally you just put:
1;
at the end of an included file, you should instead ensure that you return a reference to an array. This is treated as being true so
satisfies perl, and is a damned sight more useful.
Inside that array should be either a description of what this plugin is to do, or references to several arrays containing such
descriptions. A description consists of two or three items. First a string telling us what the first data-type handled by your plugin is.
Second, (and optional, defaulting to the same as the first) the second data-type to compare. To handle comparisons to ordinary scalars,
give the empty string for the data-type, ie:
['MyType', '', sub { ...}]
Third and last, we need a reference to the subroutine which does the comparison. That subroutine should expect to take two parameters,
which will be of the specified type. It should return 1 if they compare the same, or 0 if they compare different.
Be aware that while you might give a description like:
['Type1', 'Type2', sub { ... }]
this will handle both comparing Type1 to Type2, and comparing Type2 to Type1. ie, comparison is commutative.
If you want to use Data::Compare's own comparison function from within your handler (to, for example, compare a data structure that you
have stored somewhere in your object) then you will need to call it as Data::Compare::Compare. However, you must be careful to avoid
infinite recursion by calling D::C::Compare which in turn calls back to your handler.
The name of your plugins does not matter, only that it lives in one of those directories. Of course, giving it a sensible name means that
the usual installation mechanisms will put it in the right place, and meaningful names will make it easier to debug your code.
For an example, look at the plugin that handles Scalar::Properties objects, which is distributed with Data::Compare.
DISTRIBUTION
Provided that the above rules are followed I see no reason for you to not upload your plugin to the CPAN yourself. You will need to make
Data::Compare a pre-requisite, so that the CPAN.pm installer does the right thing.
Alternatively, if you would prefer me to roll your plugin in with the Data::Compare distribution, I'd be happy to do so provided that the
code is clear and well-commented, and that you include tests and documentation.
SEE ALSO
Data::Compare
Data::Compare::Plugins::Scalar::Properties
AUTHOR
Copyright (c) 2004 David Cantrell <david@cantrell.org.uk>. All rights reserved. This program is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
perl v5.16.2 2009-03-07 Data::Compare::Plugins(3)