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 DEBIAN
data::serializer::raw
Data::Serializer::Raw(3pm) User Contributed Perl Documentation Data::Serializer::Raw(3pm)NAME
Data::Serializer::Raw - Provides unified raw interface to perl serializers
SYNOPSIS
use Data::Serializer::Raw;
$obj = Data::Serializer::Raw->new();
$obj = Data::Serializer::Raw->new(serializer => 'Storable');
$serialized = $obj->serialize({a => [1,2,3],b => 5});
$deserialized = $obj->deserialize($serialized);
print "$deserialized->{b}
";
DESCRIPTION
Provides a unified interface to the various serializing modules currently available.
This is a straight pass through to the underlying serializer, nothing else is done. (no encoding, encryption, compression, etc)
EXAMPLES
Please see Data::Serializer::Cookbook(3)METHODS
new - constructor
$obj = Data::Serializer::Raw->new();
$obj = Data::Serializer::Raw->new(
serializer => 'Data::Dumper',
options => {},
);
new is the constructor object for Data::Serializer::Raw objects.
o The default serializer is "Data::Dumper"
o The default options is "{}" (pass nothing on to serializer)
serialize - serialize reference
$serialized = $obj->serialize({a => [1,2,3],b => 5});
This is a straight pass through to the underlying serializer, nothing else is done. (no encoding, encryption, compression, etc)
deserialize - deserialize reference
$deserialized = $obj->deserialize($serialized);
This is a straight pass through to the underlying serializer, nothing else is done. (no encoding, encryption, compression, etc)
serializer - change the serializer
Currently supports the following serializers:
Bencode(3)Convert::Bencode(3)Convert::Bencode_XS(3)Config::General(3)Data::Denter(3)Data::Dumper(3)Data::Taxi(3)FreezeThaw(3)JSON(3)JSON::Syck(3)PHP::Serialization(3)Storable(3)XML::Dumper(3)XML::Simple(3)YAML(3)YAML::Syck(3)
Default is to use Data::Dumper.
Each serializer has its own caveat's about usage especially when dealing with cyclical data structures or CODE references. Please see
the appropriate documentation in those modules for further information.
options - pass options through to underlying serializer
Currently is only supported by Config::General(3), and XML::Dumper(3).
my $obj = Data::Serializer::Raw->new(serializer => 'Config::General',
options => {
-LowerCaseNames => 1,
-UseApacheInclude => 1,
-MergeDuplicateBlocks => 1,
-AutoTrue => 1,
-InterPolateVars => 1
},
) or die "$!
";
or
my $obj = Data::Serializer::Raw->new(serializer => 'XML::Dumper',
options => { dtd => 1, }
) or die "$!
";
store - serialize data and write it to a file (or file handle)
$obj->store({a => [1,2,3],b => 5},$file, [$mode, $perm]);
or
$obj->store({a => [1,2,3],b => 5},$fh);
Serializes the reference specified using the serialize method and writes it out to the specified file or filehandle.
If a file path is specified you may specify an optional mode and permission as the next two arguments. See IO::File for examples.
Trips an exception if it is unable to write to the specified file.
retrieve - read data from file (or file handle) and return it after deserialization
my $ref = $obj->retrieve($file);
or
my $ref = $obj->retrieve($fh);
Reads first line of supplied file or filehandle and returns it deserialized.
AUTHOR
Neil Neely <neil@neely.cx>.
http://neil-neely.blogspot.com/
BUGS
Please report all bugs here:
http://rt.cpan.org/Public/Dist/Display.html?Name=Data-Serializer
COPYRIGHT AND LICENSE
Copyright (c) 2011 Neil Neely. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or,
at your option, any later version of Perl 5 you may have available.
See http://www.perl.com/language/misc/Artistic.html
ACKNOWLEDGEMENTS
Peter Makholm took the time to profile Data::Serializer(3) and pointed out the value of having a very lean implementation that minimized
overhead and just used the raw underlying serializers.
SEE ALSO perl(1), Data::Serializer(3).
perl v5.12.4 2011-08-16 Data::Serializer::Raw(3pm)