04-16-2008
Quote:
Originally Posted by
Hone1975
How I run that awk script in Solaris unix shell? (Couple of lines, error comes if I run it on one line).
The last version should work well even on one line,
could you post the command and the errors (just copy/paste them from your terminal)?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a data file:
abc Text Text Text Unique Text
123 Text word Line Unique Text
fgh Text data Line Unique Text
789 Text Text Line Unique Text
543 Text Text Data Unique Text
and a filter file
123
789
I want to extract out from the data file the two records that contain the keys... (1 Reply)
Discussion started by: tumblez
1 Replies
2. Shell Programming and Scripting
hi all,
I have this file with some user data.
example:
$cat myfile.txt
FName|LName|Gender|Company|Branch|Bday|Salary|Age
aaaa|bbbb|male|cccc|dddd|19900814|15000|20|
eeee|asdg|male|gggg|ksgu|19911216|||
aara|bdbm|male|kkkk|acke|19931018||23|
asad|kfjg|male|kkkc|gkgg|19921213|14000|24|... (4 Replies)
Discussion started by: srimal
4 Replies
3. UNIX for Advanced & Expert Users
i have file server 1 (filesvr01acess.log) and disc server 1 (discsvr01acess.log) in unix box(say ip adress of the box 10.39.66.81)
Similiarly i have file server 2 (filesvr01acess.log) and disc server 2(discsvr01acess.log) in another unix box(say ip adress of the box 10.39.66.82).
Now my... (1 Reply)
Discussion started by: nripa1
1 Replies
4. Shell Programming and Scripting
Hi All ,
I have one file like below ,
Owner name = abu2-kxy-m29.hegen.app
Item_id = AX1981, special_id = *NULL*, version = 1
Created = 09/01/2010 12:56:56 (1283389016)
Enddate = 03/31/2011 00:00:00 (1301554800)
From the above file I need to get the output in the below format ,i need... (3 Replies)
Discussion started by: gnanasekar_beem
3 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I have a file with hundreds of records.
There are four fields on each line, separated by semicolons.
Name
Height (meters)
Country
Continent (Africa,Asia,Europe,North America,Oceania,South
America,The Poles)
I need to Write the command to find display how many mountains appear... (1 Reply)
Discussion started by: erora
1 Replies
6. Shell Programming and Scripting
I have a .kml file. So I want filter the .kml to get only the tags that have this numeric codes that they are in a text file
11951
11952
74014
11964
11965
11969
11970
11971
11972
60149
74018
74023
86378
11976
11980
11983
11984
11987 (5 Replies)
Discussion started by: pcoj33
5 Replies
7. Shell Programming and Scripting
Hi...
I would like to filter out my data file....in two different way
1st way is like this, I will take one example..here...
The script should ask like this.
Enter min value in first column
Enter max value in first column
Enter min value in second column
Enter max value in... (5 Replies)
Discussion started by: nex_asp
5 Replies
8. UNIX for Dummies Questions & Answers
Hello,
I am very now to this, hope you can help,
I am looking into editing a file in Solaris, with dinamic collums (lenght varies) and I need 2 things to be made, the fist is to filter the first column and third column from the file bellow file.txt, and create a new file with the 2 filtered... (8 Replies)
Discussion started by: jpbastos
8 Replies
9. UNIX for Dummies Questions & Answers
sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies
10. UNIX for Dummies Questions & Answers
Hi Folks,
I have a text file with lots of rows with duplicates in the first column, i want to filter out records based on filter columns in a different filter text file.
bash scripting is what i need.
Data.txt
Name OrderID Quantity
Sam 123 300
Jay 342 498
Kev 78 2500
Sam 420 50
Vic 10... (3 Replies)
Discussion started by: tech_frk
3 Replies
LEARN ABOUT DEBIAN
poe::filter::map
POE::Filter::Map(3pm) User Contributed Perl Documentation POE::Filter::Map(3pm)
NAME
POE::Filter::Map - transform input and/or output within a filter stack
SYNOPSIS
#!perl
use POE qw(
Wheel::FollowTail
Filter::Line Filter::Map Filter::Stackable
);
POE::Session->create(
inline_states => {
_start => sub {
my $parse_input_as_lines = POE::Filter::Line->new();
my $redact_some_lines = POE::Filter::Map->new(
Code => sub {
my $input = shift;
$input = "[REDACTED]" unless $input =~ /sudo[d+]/i;
return $input;
},
);
my $filter_stack = POE::Filter::Stackable->new(
Filters => [
$parse_input_as_lines, # first on get, last on put
$redact_some_lines, # first on put, last on get
]
);
$_[HEAP]{tailor} = POE::Wheel::FollowTail->new(
Filename => "/var/log/system.log",
InputEvent => "got_log_line",
Filter => $filter_stack,
);
},
got_log_line => sub {
print "Log: $_[ARG0]
";
}
}
);
POE::Kernel->run();
exit;
DESCRIPTION
POE::Filter::Map transforms data inside the filter stack. It may be used to transform input, output, or both depending on how it is
constructed. This filter is named and modeled after Perl's built-in map() function.
POE::Filter::Map is designed to be combined with other filters through POE::Filter::Stackable. In the "SYNOPSIS" example, a filter stack
is created to parse logs as lines and redact all entries that don't pertain to a sudo process.
PUBLIC FILTER METHODS
In addition to the usual POE::Filter methods, POE::Filter::Map also supports the following.
new
new() constructs a new POE::Filter::Map object. It must either be called with a single Code parameter, or both a Put and a Get parameter.
The values for Code, Put and Get are code references that, when invoked, return transformed versions of their sole parameters. A Code
function will be used for both input and output, while Get and Put functions allow input and output to be filtered in different ways.
# Decrypt rot13.
sub decrypt_rot13 {
my $encrypted = shift;
$encrypted =~ tr[a-zA-Z][n-za-mN-ZA-M];
return $encrypted;
}
# Encrypt rot13.
sub encrypt_rot13 {
my $plaintext = shift;
$plaintext =~ tr[a-zA-Z][n-za-mN-ZA-M];
return $plaintext;
}
# Decrypt rot13 on input, and encrypt it on output.
my $rot13_transcrypter = POE::Filter::Map->new(
Get => &decrypt_rot13,
Put => &encrypt_rot13,
);
Rot13 is symmetric, so the above example can be simplified to use a single Code function.
my $rot13_transcrypter = POE::Filter::Map->new(
Code => sub {
local $_ = shift;
tr[a-zA-Z][n-za-mN-ZA-M];
return $_;
}
);
modify
modify() changes a POE::Filter::Map object's behavior at run-time. It accepts the same parameters as new(), and it replaces the existing
transforms with new ones.
# Switch to "reverse" encryption for testing.
$rot13_transcrypter->modify(
Code => sub { return scalar reverse shift }
);
SEE ALSO
POE::Filter for more information about filters in general.
POE::Filter::Stackable for more details on stacking filters.
BUGS
None known.
AUTHORS & COPYRIGHTS
The Map filter was contributed by Dieter Pearcey. Documentation is provided by Rocco Caputo.
Please see the POE manpage for more information about authors and contributors.
perl v5.14.2 2012-05-15 POE::Filter::Map(3pm)