10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Could you please help me finding a way to replace a specific value in a text block when matching a key pattern ?
I got the keys and the values from a command similar to:
echo -e "key01 Nvalue01-1 Nvalue01-2 Nvalue01-3\nkey02 Nvalue02-1 Nvalue02-2 Nvalue02-3 \nkey03 Nvalue03-1... (2 Replies)
Discussion started by: alex2005
2 Replies
2. Shell Programming and Scripting
In the awk below I am trying to remove all instances after a ; (semi-colon) or , (comma) in the ANN= pattern. I am using gsub
to substitute an empty string in these, so that ANN= is a single value (with only one value in it the one right after the ANN=). Thank you :).
I have comented my awk and... (11 Replies)
Discussion started by: cmccabe
11 Replies
3. Shell Programming and Scripting
I have one file and the file may contain 500 to 15,000 records. I need to search pattern ^F509= and then increment the corresponding value by one and print the entire line.
Please note that Its not a fixed length file. Can anyone please help?
ex: ^F509=204656
^F509=204656
... (6 Replies)
Discussion started by: vinus
6 Replies
4. Shell Programming and Scripting
The intended result should be :
PDF converters
'empty line'
gpdftext and pdftotext?xml version="1.0"?>
xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters
gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies
5. UNIX for Dummies Questions & Answers
I have a file with data merged from multiple files. File contains header, data and trailer of multiple files. The trailer starts with 99 and delimiter is ~.
Trailer
99~120
99~30
As it is a merged file we i have multiple lines followed by 99~. Need help to find sum of values which are there... (4 Replies)
Discussion started by: santoshdrkr
4 Replies
6. UNIX for Dummies Questions & Answers
Hi experts , im new to Unix,AWK ,and im just not able to get this right.
I need to match for some patterns if it matches I need to print the next few words to it.. I have only three such conditions to match… But I need to print only those words that comes after satisfying the first condition..... (2 Replies)
Discussion started by: 100bees
2 Replies
7. Shell Programming and Scripting
Hi All,
I have a file with data as below:
A,FILE1_MYFILE_20130309_1038,80,25.60
B,FILE1_MYFILE_20130309_1038,24290,18543.38
C,FILE1_dsc_dlk_MYFILE_20130309_1038,3,10.10
A,FILE2_MYFILE_20130310_1039,85,110.10
B,FILE2_MYFILE_20130310_1039,10,12.10... (10 Replies)
Discussion started by: angshuman
10 Replies
8. Shell Programming and Scripting
Here in the input file
23:59:13,devicename,21,server1,700
23:59:13,devicename,22,server2,200
23:59:13,devicename,23,server3,200
23:59:13,devicename,24,server4,200
23:59:13,devicename,25,server5,200
23:59:13,devicename,26,server6,200
23:59:13,devicename,27,server7,200... (6 Replies)
Discussion started by: necro98
6 Replies
9. AIX
Hi All ,
I have a small code that checks pattern of digits entered in unix mode .
$ echo 201202 | wc -c
7 /* output*/
When i run same command in AIX 5.1 , i am getting output with some initial blanks
$ echo 201202 | wc -c
7 ... (4 Replies)
Discussion started by: Perlbaby
4 Replies
10. Shell Programming and Scripting
I am trying to do some thing like this ..
In a file , if pattern found insert new pattern at the begining of the line containing the pattern.
example:
in a file I have this.
gtrow0unit1/gctunit_crrownorth_stage5_outnet_feedthru_pin
if i find feedthru_pin want to insert !! at the... (7 Replies)
Discussion started by: pitagi
7 Replies
Class::Gomor::Hash(3pm) User Contributed Perl Documentation Class::Gomor::Hash(3pm)
NAME
Class::Gomor::Hash - class and object builder, hash version
SYNPOSIS
# Create a base class in BaseClass.pm
package My::BaseClass;
require Class::Gomor::Hash;
our @ISA = qw(Class::Gomor::Hash);
our @AS = qw(attribute1 attribute2);
our @AA = qw(attribute3 attribute4);
our @AO = qw(other);
# You should initialize yourself array attributes
sub new { shift->SUPER::new(attribute3 => [], attribute4 => [], @_) }
# Create accessors
My::BaseClass->cgBuildAccessorsScalar(@AS);
My::BaseClass->cgBuildAccessorsArray(@AA);
sub other {
my $self = shift;
@_ ? $self->{'other'} = [ split(/
/, shift) ]
: @{$self->{'other'}};
}
1;
# Create a subclass in SubClass.pm
package My::SubClass;
require My::BaseClass;
our @ISA = qw(My::BaseClass);
our @AS = qw(subclassAttribute);
My::SubClass->cgBuildAccessorsScalar(@AS);
sub new {
shift->SUPER::new(
attribute1 => 'val1',
attribute2 => 'val2',
attribute3 => [ 'val3', ],
attribute4 => [ 'val4', ],
other => [ 'none', ],
subclassAttribute => 'subVal',
);
}
1;
# A program using those classes
my $new = My::SubClass->new;
my $val1 = $new->attribute1;
my @values3 = $new->attribute3;
my @otherOld = $new->other;
$new->other("str1
str2
str3");
my @otherNew = $new->other;
print "@otherNew
";
$new->attribute2('newValue');
$new->attribute4([ 'newVal1', 'newVal2', ]);
DESCRIPTION
This class is a subclass from Class::Gomor. It implements objects as hash references, and inherits methods from Class::Gomor.
GLOBAL VARIABLE
See Class::Gomor.
METHODS
new (hash)
Object constructor. This is where user passed attributes (hash argument) are checked against valid attributes (gathered by
cgGetAttributes method). Valid attributes are those that exists (doh!), and have not an undef value. The default is to check this, you
can avoid it by setting $NoCheck global variable (see perldoc Class::Gomor).
cgBuildIndices
This method does nothing. It only exists to make it more easy to switch between Class::Gomor::Array and Class::Gomor::Hash.
cgBuildAccessorsScalar (array ref)
cgBuildAccessorsArray (array ref)
See Class::Gomor.
cgGetIndice (scalar)
This method does nearly nothing. It only returns the passed-in scalar parameter (so the syntax is the same as in Class::Gomor::Array).
It only exists to make it more easy to switch between Class::Gomor::Array and Class::Gomor::Hash.
cgClone [ (scalar) ]
You can clone one of your objects by calling this method. An optional parameter may be used to create multiple clones. Cloning will
occure only on the first level attributes, that is, if you have attributes containing other objects, they will not be cloned.
cgFullClone [ (scalar) ]
This method is the same as cgClone, but will clone all attributes recursively, but only if they are subclassed from Class::Gomor. So,
objects created with other modules than Class::Gomor::Array or Class::Gomor::Hash will not be cloned.
Another thing to note, there is no catch for cycling references (when you link two objects with each others). You have been warned.
cgDumper
Will return a string as with Data::Dumper Dumper method. This is less useful for hashref objects, because they already include
attributes names.
SEE ALSO
Class::Gomor
AUTHOR
Patrice <GomoR> Auffret
COPYRIGHT AND LICENSE
Copyright (c) 2004-2009, Patrice <GomoR> Auffret
You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.
perl v5.10.1 2009-05-23 Class::Gomor::Hash(3pm)