Hi,
I know how to use awk to search some expressions like five consecutive numbers, , this is easy.
However, how do I make awk print the pattern that is been matched?
For example:
input: usa,canada99292,japan222,france59664,egypt223
output:99292,59664 (6 Replies)
I have a file with the following content.
> cat /tmp/internetusage.txt
6709.296322 30000 2/7/2010 0.00I am using the following awk command to calculate a percentage from field 1 and 2 from the file.
awk '{ print $1/$2*100 }' /tmp/internetusage.txt
This outputs the value "22.3643" as a... (1 Reply)
Hi, I have 2 files that I have modified to basically match each other, however I want to determine what (if any) line in file 1 does not exist in file 2. I need to match column $1 and $2 as a single string in file1 to $1 and $2 in file2 as these two columns create a match.
I'm stuck in an AWK... (9 Replies)
Hi All,
I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file.
Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Hello Guyz
I have been following this forum for a while and the solutions provided are super useful. I currently have a scenario where i need to search for a pattern and start searching by keeping the first pattern as a baseline
ABC
DEF
LMN
EFG
HIJ
LMN
OPQ
In the above text i need to... (8 Replies)
Hi All,
I have result log file which looks like this (below): from the content need to consolidate the result and put it in tabular form
1). Intercomponents Checking
Passed: All Server are passed.
======================================================================
2). OS version Checking... (9 Replies)
Hi ,
I have a file where i have modifed certain things compared to original file . The difference of the original file and modified file is as follows.
# diff mir_lex.c.modified mir_lex.c.orig
3209c3209
< if(yy_current_buffer -> yy_is_our_buffer == 0) {
---
>... (5 Replies)
Hi,
I need to search for a word using Awk and print out the line the word is in and every line after the search phrase until I hit this #------------. Then I need to send it to a csv file.
So basically the input file format is like this:... (1 Reply)
I am trying to combine lines with these conditions:
1. First line starts with text of "libname VALUE db2 datasrc" where VALUE can be any text.
2. If condition1 is met then continue to combine lines through a line that ends with a semicolon.
3. Ignore case when matching patterns and remove any... (5 Replies)
In the awk below I am trying to remove all lines above and including the pattern Test or Test2. Each block is seperated by a newline and Test2 also appears in the lines to keep but it will always have additional text after it. The Test to remove will not. The awk executed until the || was added... (2 Replies)
Discussion started by: cmccabe
2 Replies
LEARN ABOUT REDHAT
data::grove::parent
Data::Grove::Parent(3) User Contributed Perl Documentation Data::Grove::Parent(3)NAME
Data::Grove::Parent - provide parent properties to Data::Grove objects
SYNOPSIS
use Data::Grove::Parent;
$root = $object->root;
$rootpath = $object->rootpath;
$tied = $object->add_magic([ $parent ]);
$node = Data::Grove::Parent->new($hash [, $parent]);
$node_list = Data::Grove::ParentList->new($array [, $parent]);
DESCRIPTION
Data::Grove::Parent is an extension to Data::Grove that adds `"Parent"' and `"Raw"' properties to Data::Grove objects and methods for
returning the root node of a grove, a list of nodes between and including the root node and the current node, and a method that creates
parented nodes.
Data::Grove::Parent works by creating a Perl ``tied'' object that contains a parent reference (`"Parent"') and a reference to the original
Data::Grove object (`"Raw"'). Tying-magic is used so that every time you reference the Data::Grove::Parent object it actually references
the underlying raw object.
When you retrieve a list or a property of the Raw object, Data::Grove::Parent automatically adds magic to the returned list or node. This
means you only call `add_magic()' once to create the first Data::Grove::Parent object and then use the grove objects like you normally
would.
The most obvious use of this is so you don't have to call a `"delete"' method when you want to release a grove or part of a grove; since
Data::Grove and Data::Grove::Parent objects have no cyclic references, Perl can garbage collect them normally.
A secondary use is to allow you to reuse grove or property set fragments in multiple trees. WARNING: Data::Grove currently does not pro-
tect you from creating your own cyclic references! This could lead to infinite loops if you don't take care to avoid them.
METHODS
$object->root()
$object->rootpath()
`"root()"' returns the root node if `$object' is a `"Data::Grove::Parent"' object. `"rootpath()"' returns an array of all the nodes
between and including the root node and `$object'.
$tied = $object->add_magic([ $parent ])
`"add_magic()"' returns a "Data::Grove::Parent" object with `$object' as it's `"Raw"' object. If `$parent' is given, that becomes the
tied object's parent object.
AUTHOR
Ken MacLeod, ken@bitsko.slc.ut.us
SEE ALSO perl(1), Data::Grove(3)perl v5.8.0 2000-02-22 Data::Grove::Parent(3)