Welcome to forums, please use code tags for commands/codes/Inputs which you are using in your posts as per forum rules. You could try following an awk solution.
Output will be as follows.
Off course it will work only for keywords key1 and key2 as per your shown input, if you have more conditions please do let us know.
Hi
It is possible with sed to print a pattern within a line matching regexp?
So, the line looks like : 19:00:00 blablablabla jobid 2345 <2>
the regexp is "jobid 2345" and the pattern is 56434.
That the code for find... (2 Replies)
How can I use sed to print rulers of x characters in length on my terminal?
For example, I want sed to print a 50-character rule.
sed '// p' ??
Thanks! (5 Replies)
I have file.txt
bob
jon
jones
gary
I want to print from the botton, up using sed.
gary
jones
jon
bob
Whats one command I can use to do this? Or will I have to construct a new file that would hold the original file in reverse and then print the reversed file? (3 Replies)
Hi folks,
Lets say I have the following text file:
name, lastname, 1234, name.lastname@test.com
name1, lastname1, name2.lastname2@test.com, 2345
name, 3456, lastname, name3.lastname3@test.com
4567, name, lastname, name4.lastname4@test.com
I now need the following output:
1234... (5 Replies)
Hello,
ı want to started shell programing. But first, I want to learn ssh code. How can I use this codes ( sed - awk - print ). How do codes work?
Thanks..
Best Wishes.. (1 Reply)
I am trying to figure out a one liner to toggle a flag variable. eg.
FLAG=0
Is there a way to use sed to toggle above example between 0 and 1. That is if run with flag set to zero it would change it to one if run again it would set it to zero.
I thought I had it figured but the... (6 Replies)
Hi
Imagine that I have a text file containing the following student's data:
student: john
group: A
sex: male
age: 25
student: alice
sex: female
age: 20
group: B
It is guarantee the details will start by "student:", and then followed by the sex, age and group in any order.
Is it... (2 Replies)
Dear all,
How can I print results (and of course, send this result to the text file) of sed command.
I mean, I want to know which lines of which files sed command has found.
For e.g, the result text file should contains:
file1.c:line 12
file2.h:line 14
file2.h:line 37
Please help me (10 Replies)
Hi
I am working with sed to get string replace and print all the lines.
Cat f1
<text1>
tag123 44412c232place1
text456-text=
tag12 44412c232place4
jjaa
TAG456 44412c232place1066dfdf
erer
..
i have used this command -
sed -n '/tag/ s#place#SomePlace#gp' f1
It gives me... (2 Replies)
Discussion started by: krsnadasa
2 Replies
LEARN ABOUT DEBIAN
config::model::hashid
Config::Model::HashId(3pm) User Contributed Perl Documentation Config::Model::HashId(3pm)NAME
Config::Model::HashId - Handle hash element for configuration model
VERSION
version 2.021
SYNOPSIS
See "SYNOPSIS" in Config::Model::AnyId
DESCRIPTION
This class provides hash elements for a Config::Model::Node.
The hash index can either be en enumerated type, a boolean, an integer or a string.
CONSTRUCTOR
HashId object should not be created directly.
Hash model declaration
See model declaration section from Config::Model::AnyId.
Methods
get_type
Returns "hash".
fetch_size
Returns the number of elements of the hash.
firstkey
Returns the first key of the hash. Behaves like "each" core perl function.
nextkey
Returns the next key of the hash. Behaves like "each" core perl function.
swap ( key1 , key2 )
Swap the order of the 2 keys. Ignored for non ordered hash.
move ( key1 , key2 )
Rename key1 in key2.
move_after ( key_to_move [ , after_this_key ] )
Move the first key after the second one. If the second parameter is omitted, the first key is placed in first position. Ignored for non
ordered hash.
move_up ( key )
Move the key up in a ordered hash. Attempt to move up the first key of an ordered hash will be ignored. Ignored for non ordered hash.
move_down ( key )
Move the key down in a ordered hash. Attempt to move up the last key of an ordered hash will be ignored. Ignored for non ordered hash.
load_data ( hash_ref | array_ref )
Load check_list as a hash ref for standard hash.
Ordered hash should be loaded with an array ref or with a hash containing a special "__order" element. E.g. loaded with either:
[ a => 'foo', b => 'bar' ]
or
{ __order => ['a','b'], b => 'bar', a => 'foo' }
AUTHOR
Dominique Dumont, (ddumont at cpan dot org)
SEE ALSO
Config::Model, Config::Model::Instance, Config::Model::AnyId, Config::Model::ListId, Config::Model::Value
perl v5.14.2 2012-11-09 Config::Model::HashId(3pm)