09-27-2008
Thanks Franklin. It seems to work altho from reading it, I don't know why it's grabbing numerals from $BUILD instead of $VERSION....
I thought sed worked from first to last so my understanding from that command is "print the first digits after the first hyphen".
But, it's worked with what I've thrown at it so far. I'll see if I can't wrap my head around it more.
10 More Discussions You Might Find Interesting
1. Linux
Hi ,
I have a question. How do I replace 2 words in one line like this
IN CLO07 INDEX IN CLOIX07
to
IN CLO07_S02 INDEX IN CLOIX07_S02
But one thing to remember is that there are lots of words like CLODM001 .
So the only matching pattern is "IN CLO"
sample file... (4 Replies)
Discussion started by: capri_drm
4 Replies
2. HP-UX
how can I find cpu usage memory usage swap usage and
I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times
my final destination is monitor process
logical volume usage above X % and number of Logical voluage above
can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies
3. Shell Programming and Scripting
I'd like to extract the temps from the following command via a series of sed statements but the actual syntax is beyond me.
$ nc localhost 7634 ... (2 Replies)
Discussion started by: audiophile
2 Replies
4. AIX
How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies
5. Shell Programming and Scripting
How can i use sed to change "Linux Cpu (EDF).sh" to "LinuxCpuEDF.sh"?
I want to replace the spaces and brackets. (4 Replies)
Discussion started by: proactiveaditya
4 Replies
6. Shell Programming and Scripting
Hi,
I want to read a command value and replace the command value in another file.
Anybody know how to write it???
For example:
File A:
Command1 = test
File B:
Command1 =
Command2 =
Command3 =
I want to write a shell script to read content from File A and replace Command1... (3 Replies)
Discussion started by: linboco
3 Replies
7. Shell Programming and Scripting
Hi,
I want to replace some character whenever there is a space using sed.
Input file name: aaa
command i am trying is
sed 's/^$/A/g' aaa (2 Replies)
Discussion started by: rakeshbharadwaj
2 Replies
8. Shell Programming and Scripting
Friends,
I came across a wierd scenario while using sed. When I use the below cmd sequence at OS prompt it works fine:
sed 's/# TMOUT=120/TMOUT=900/g' /etc/profile > /etc/profile.011211
However when I use the same in a script it throws the following error:
==Error==
sed: 0602-404... (4 Replies)
Discussion started by: thisissouvik
4 Replies
9. Shell Programming and Scripting
Gurus,
I am trying to display a match (single character) from beginning of the line in a file using a variable.
I tried using sed ... not sure where am doing it wrong...
sed -n "/^\$variable/p" FileName.shor
sed -n "/^\${variable}/p" FileName.shBoth of the above are not working.....Thanks... (4 Replies)
Discussion started by: Kevin Tivoli
4 Replies
10. Shell Programming and Scripting
Hi,
Can anyone let me know the sed command usage
requirement:
sed 's/standard/standard_and/' <new.txt>new.txt
here it needs to search for the pattern "standard" in the file new.txt and it should replace as "standard_and" in the same file new.txt
Note: new.txt is having a separator... (8 Replies)
Discussion started by: srikanth_sagi
8 Replies
LEARN ABOUT OSX
moose::cookbook::extending::recipe2
Moose::Cookbook::Extending::Recipe2(3) User Contributed Perl Documentation Moose::Cookbook::Extending::Recipe2(3)
NAME
Moose::Cookbook::Extending::Recipe2 - Providing a role for the base object class
VERSION
version 2.0205
SYNOPSIS
package MooseX::Debugging;
use Moose::Exporter;
Moose::Exporter->setup_import_methods(
base_class_roles => ['MooseX::Debugging::Role::Object'],
);
package MooseX::Debugging::Role::Object;
use Moose::Role;
sub BUILD {}
after BUILD => sub {
my $self = shift;
warn "Made a new " . ( ref $self ) . " object
";
};
DESCRIPTION
In this example, we provide a role for the base object class that adds some simple debugging output. Every time an object is created, it
spits out a warning saying what type of object it was.
Obviously, a real debugging role would do something more interesting, but this recipe is all about how we apply that role.
In this case, with the combination of Moose::Exporter and Moose::Util::MetaRole, we ensure that when a module does "use MooseX::Debugging",
it automatically gets the debugging role applied to its base object class.
There are a few pieces of code worth looking at more closely.
Moose::Exporter->setup_import_methods(
base_class_roles => ['MooseX::Debugging::Role::Object'],
);
This creates an "import" method in the "MooseX::Debugging" package. Since we are not actually exporting anything, we do not pass
"setup_import_methods" any parameters related to exports, but we need to have an "import" method to ensure that our "init_meta" method is
called. The "init_meta" is created by "setup_import_methods" for us, since we passed the "base_class_roles" parameter. The generated
"init_meta" will in turn call Moose::Util::MetaRole::apply_base_class_roles.
sub BUILD {}
after BUILD => sub {
...
};
Due to the way role composition currently works, if the class that a role is composed into contains a "BUILD" method, then that will
override the "BUILD" method in any roles it composes, which is typically not what you want. Using a method modifier on "BUILD" avoids this
issue, since method modifiers compose together rather than being overridden. Method modifiers require that a method exists in order to
wrap, however, so we also provide a stub method to wrap if no "BUILD" method exists in the class.
AUTHOR
Stevan Little <stevan@iinteractive.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Infinity Interactive, Inc..
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.12.5 2011-09-06 Moose::Cookbook::Extending::Recipe2(3)