This is the difficult part. This is supposed to be for an configuration file.
so lets say,
before:
so there is "vi" command given for the file. so in this case the code for editing only the "section_a" of the configuration
so in some sense i want to edit specific section of configuration file. save it it temp file. and then updated the edited section.
The whole point of going through this exercise was to give user chance to update only the section he wants and hiding the rest of configuration temporarily.
i have to search a string and replace with multiple lines.
example
Input
echo 'sample text'
echo 'college days'
output
echo 'sample text'
echo 'information on students'
echo 'emp number'
echo 'holidays'
i have to search a word college and replace the multiple lines
i have... (1 Reply)
My sql file xyz_abc.sql in this file there are multiple sql block in this block I need to find the following block
rem Subset Rows (&&tempName.*)
CREATE VIEW &&tempName.* AS
SELECT *
FROM &&tempName.*
WHERE f is not null
and replace with following code
rem Subset Rows... (9 Replies)
Can someone tell me how I can do this?
e.g:
Say file1.txt contains:
today is monday
the 22 of
NOVEMBER
2010
and file2.txt contains:
the
11th
month
of
How do i replace the word NOVEMBER with (5 Replies)
Hello everyone,
ive been trying to replace a string "kw01" in an xml file with the contents of a txt file having multiple lines. im a unix newbie and all the sed combinations i tried resulted to being garbled. Below is the contents of the txt file:
RAISEDATTIME
--------------------... (13 Replies)
Can someone tell me how I can do this?
e.g:
a=$(echo -e wert trewt ertert ertert ertert erttert
erterte
rterter
tertertert
ert)
How do i replace the STRING with $a?
I try this:
sed -i 's/STRING/'"$a"'/g' filename.ext
but this don' t work (2 Replies)
hey guys,
I tried searching but most 'search and replace' questions are related to one liners.
Say I have a file to be replaced that has the following:
$ cat testing.txt
TESTING
AAA
BBB
CCC
DDD
EEE
FFF
GGG
HHH
ENDTESTING
This is the input file: (3 Replies)
Hey guys. I know pratically 0 about Linux, so could anyone please give me instructions on how to accomplish this ?
The distro is RedHat 4.1.2 and i need to find and replace a multiple lines string in several php files across subdirectories.
So lets say im at root/dir1/dir2/ , when i execute... (12 Replies)
Hi All,
I have a input file as sample below
<this is not starting of file>
record
line1
line2
line3
end
line4
line5
record
line6
line7
line8
my requirement is this, i want to select a pattern between first record and end, whatever is written between first record and end.
and... (0 Replies)
Hello Guys,
I need to replace a string with multiple lines.
For eg:-
ABC,DEF,GHI,JKL,MNO,PQR,STU
need to convert the above as below:-
ABC,DEF,
GHI1
GHI2
GHI3,
JKL,MNO,
PQR1
PQR2
PQR3,
STU
i have tried using code as:- (2 Replies)
GM,
I have an issue at work, which requires a simple solution. But, after multiple attempts, I have not been able to hit on the code needed.
I am assuming that sed, awk or even perl could do what I need.
I have an application that adds extra blank page feeds, for multiple reports, when... (7 Replies)
Discussion started by: jxfish2
7 Replies
LEARN ABOUT DEBIAN
class::gomor::array
Class::Gomor::Array(3pm) User Contributed Perl Documentation Class::Gomor::Array(3pm)NAME
Class::Gomor::Array - class and object builder, array version
SYNPOSIS
# Create a base class in BaseClass.pm
package My::BaseClass;
require Class::Gomor::Array;
our @ISA = qw(Class::Gomor::Array);
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 indices and accessors
My::BaseClass->cgBuildIndices;
My::BaseClass->cgBuildAccessorsScalar(@AS);
My::BaseClass->cgBuildAccessorsArray(@AA);
sub other {
my $self = shift;
@_ ? $self->[$self->cgGetIndice('other')] = [ split(/
/, shift) ]
: @{$self->[$self->cgGetIndice('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->cgBuildIndices;
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 array references, and inherits methods from Class::Gomor.
GLOBAL VARIABLES
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
You MUST call this method one time at the beginning of your classes, and all subclasses (even if you do not add new attributes). It
will build the matching between object attributes and their indices inside the array object. Global variables will be created in your
class, with the following format: $__attributeName.
cgBuildAccessorsScalar (array ref)
cgBuildAccessorsArray (array ref)
See Class::Gomor.
cgGetIndice (scalar)
Returns the array indice of specified attribute passed as a parameter. You can use it in your programs to avoid calling directly the
global variable giving indice information concerning requesting object, thus avoiding using `no strict 'vars';'. This method is usually
used when you build your own accessors (those using attributes defined in @AO).
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 useful for debugging purposes, because an arrayref object does not
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::Array(3pm)