02-21-2008
need assistance ----SH schell script
Hello All,
I need to develop a script(SH]) to generate a comparison file between two files old and new file.The script takes in parameter the old file path and the new file path. And the script generates a file containing the comparison between the two files with this details:
- Keys added on the new file (key=value)
- Keys modified on the new file (key=value)
- Keys deleted on the new file (key=value)
key column is the 4th one and value column is the 6th one in the sample file.
Example:
old file: key1,value1 new file:key4,value3
key4,value4 key6,value6
output file: comparison file
------------------
1> keys added ----- key6,value6
2>deleted ---------- key1,value1
3> modified---------- key4,value3
I'm new to schell scripting field. request you to explain briefly along with the code. any sort of assistance would be appreciated.
Thanks in advance
Regards Shahid.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am very new to Unix. I need to write a script that will grep some files, etc. When I write the script, do I need to know what shell I am using? If so, how do I do that? (1 Reply)
Discussion started by: ssmiths001
1 Replies
2. Shell Programming and Scripting
please advise..very urgent.
purpose of my script is that it should generate a report by running a sql script which is stored in a directory and pull the information from DB.script shld be in such a way that I just need to pass a parameter and it shld generate the report and store it in a... (1 Reply)
Discussion started by: complicated
1 Replies
3. Shell Programming and Scripting
Hello everybody.
Result of my script is coming out to be as mentioned in the below format.
Output::
Modified records are as follows
=
=
@abc.core.admin.jonas_user@ = value221
@abccsd.core.admin.pltf_name@ = valuee991
=
=
#######################################
I need to get... (3 Replies)
Discussion started by: shahidbakshi
3 Replies
4. Shell Programming and Scripting
When I run this command (showstatus <username> <dbname>) in the prompt, the following will be displayed in the screen:
1. Show processes
2. Start process
3. Stop process
4. Go back to prompt
Once i choose/type Option "1" (which is Show processes), it will display the list of processes... (5 Replies)
Discussion started by: xinoo
5 Replies
5. Shell Programming and Scripting
I work on AIX 5.x.
I have a script which does lot of processing & calls multiple child scripts.
How do I capture the error of the parent script if it fails?
Thanks
Sumeet (3 Replies)
Discussion started by: sumeet
3 Replies
6. Shell Programming and Scripting
I am looking for a shell script or command to automate a process of opening many files in a directory and changing a string of text. Example:
I have a apache web server that uses virtual hosting. There are approximately 2300 vhost entries or files. So in the directory... (2 Replies)
Discussion started by: jaysunn
2 Replies
7. Shell Programming and Scripting
Hey all, I need some assistance. I'm writing a script to eject tapes from a tape library, but the library is not a queued system and can only eject 15 tapes at a time.
I added paste -d : -s so that it goes through full_tapes and puts each media_id on one line separated by the :.
Now I'm... (2 Replies)
Discussion started by: em23
2 Replies
8. Shell Programming and Scripting
Hi All,
I have deployed a servlet on my server and the u r l is
http://
localhost:9080/ ExampleApp / TestJackServlet
This works fine when i launch this URL from the browser
I am looking for shell script to hit the servlet or hit the URL without launching the browser session.
I... (3 Replies)
Discussion started by: jack3698
3 Replies
9. Shell Programming and Scripting
Hi,
I am new in ksh scripting and if anyone can help that would be great.
I'm writing a script which will SSH to several machines and then would append a certain file from a NAS to the /etc/sudoers file
the problem i am having is after the script connects to a certain server the commands are... (7 Replies)
Discussion started by: galuzan
7 Replies
10. Shell Programming and Scripting
requirement : I need to read a text file and find out which particular line has highest charcters on it using the shell script.
I tried & was able to find out only for one line. I could not able to find out for the entire the line.
sed -n '10 p' ctstest.sh | wc -w
Please guide me... (5 Replies)
Discussion started by: ramkumar15
5 Replies
LEARN ABOUT OSX
data::optlist
Data::OptList(3) User Contributed Perl Documentation Data::OptList(3)
NAME
Data::OptList - parse and validate simple name/value option pairs
VERSION
version 0.107
SYNOPSIS
use Data::OptList;
my $options = Data::OptList::mkopt([
qw(key1 key2 key3 key4),
key5 => { ... },
key6 => [ ... ],
key7 => sub { ... },
key8 => { ... },
key8 => [ ... ],
]);
...is the same thing, more or less, as:
my $options = [
[ key1 => undef, ],
[ key2 => undef, ],
[ key3 => undef, ],
[ key4 => undef, ],
[ key5 => { ... }, ],
[ key6 => [ ... ], ],
[ key7 => sub { ... }, ],
[ key8 => { ... }, ],
[ key8 => [ ... ], ],
]);
DESCRIPTION
Hashes are great for storing named data, but if you want more than one entry for a name, you have to use a list of pairs. Even then, this
is really boring to write:
$values = [
foo => undef,
bar => undef,
baz => undef,
xyz => { ... },
];
Just look at all those undefs! Don't worry, we can get rid of those:
$values = [
map { $_ => undef } qw(foo bar baz),
xyz => { ... },
];
Aaaauuugh! We've saved a little typing, but now it requires thought to read, and thinking is even worse than typing... and it's got a bug!
It looked right, didn't it? Well, the "xyz => { ... }" gets consumed by the map, and we don't get the data we wanted.
With Data::OptList, you can do this instead:
$values = Data::OptList::mkopt([
qw(foo bar baz),
xyz => { ... },
]);
This works by assuming that any defined scalar is a name and any reference following a name is its value.
FUNCTIONS
mkopt
my $opt_list = Data::OptList::mkopt($input, \%arg);
Valid arguments are:
moniker - a word used in errors to describe the opt list; encouraged
require_unique - if true, no name may appear more than once
must_be - types to which opt list values are limited (described below)
name_test - a coderef used to test whether a value can be a name
(described below, but you probably don't want this)
This produces an array of arrays; the inner arrays are name/value pairs. Values will be either "undef" or a reference.
Positional parameters may be used for compability with the old "mkopt" interface:
my $opt_list = Data::OptList::mkopt($input, $moniker, $req_uni, $must_be);
Valid values for $input:
undef -> []
hashref -> [ [ key1 => value1 ] ... ] # non-ref values become undef
arrayref -> every name followed by a non-name becomes a pair: [ name => ref ]
every name followed by undef becomes a pair: [ name => undef ]
otherwise, it becomes [ name => undef ] like so:
[ "a", "b", [ 1, 2 ] ] -> [ [ a => undef ], [ b => [ 1, 2 ] ] ]
By default, a name is any defined non-reference. The "name_test" parameter can be a code ref that tests whether the argument passed it is
a name or not. This should be used rarely. Interactions between "require_unique" and "name_test" are not yet particularly elegant, as
"require_unique" just tests string equality. This may change.
The "must_be" parameter is either a scalar or array of scalars; it defines what kind(s) of refs may be values. If an invalid value is
found, an exception is thrown. If no value is passed for this argument, any reference is valid. If "must_be" specifies that values must
be CODE, HASH, ARRAY, or SCALAR, then Params::Util is used to check whether the given value can provide that interface. Otherwise, it
checks that the given value is an object of the kind.
In other words:
[ qw(SCALAR HASH Object::Known) ]
Means:
_SCALAR0($value) or _HASH($value) or _INSTANCE($value, 'Object::Known')
mkopt_hash
my $opt_hash = Data::OptList::mkopt_hash($input, $moniker, $must_be);
Given valid "mkopt" input, this routine returns a reference to a hash. It will throw an exception if any name has more than one value.
EXPORTS
Both "mkopt" and "mkopt_hash" may be exported on request.
AUTHOR
Ricardo Signes <rjbs@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2006 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.16.2 2011-05-06 Data::OptList(3)