Sponsored Content
Top Forums Shell Programming and Scripting extracting non-zero pairs of numbers from each row Post 302684613 by Corona688 on Thursday 9th of August 2012 08:07:15 PM
Old 08-09-2012
By 'pair' do you mean 'two in a row', or do they not have to be directly after each other?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

extracting a row from a file

hi... i want to extract single row from a file at a time and i don't want to specify which row to be extracted in the command. i mean i want to use a loop, so that i will fetch all the rows one after the another. i used sed -n '$count p' filename but this is not working. please give me the... (2 Replies)
Discussion started by: Usha Shastri
2 Replies

2. Shell Programming and Scripting

Extracting numbers from a string

Hello Everyone, i have quick question. I have file names like: bin_map300.asc and I would like to extract grid300. My approach so far: name=bin_map300.asc echo ${name%%.*} echo ${name##*_} I am stuck combining the two. Any help would be appreciated. (3 Replies)
Discussion started by: creamcheese
3 Replies

3. Shell Programming and Scripting

counting the numbers in a row

File A aa <space> --D--A--D---DDY---M--UM-M--MY Another file D3 M9 So output shud be Here in FileA D which is 3 after removing dash after we have counted dash D is position at 9 and for M is 23 final output will be D9 M23 (2 Replies)
Discussion started by: cdfd123
2 Replies

4. Shell Programming and Scripting

Adding row of numbers

is there another way of doing the below: echo "7 3 8 2 2 1 3 83.4 8.2 4 8 73 90.5" | bc shell is bash. os is linux and sunos. bc seems to have an issue with long range of numbers (12 Replies)
Discussion started by: SkySmart
12 Replies

5. UNIX for Dummies Questions & Answers

Print last row of numbers

I have a spreadsheet of extremely long rows of numbers. I want to print only the last column. Tried using printf but there seems to be too many rows. example: 3 100 34 7 23 0 8 ..... X 400 203 778 1 ..........Y 58 3 9 0 100 ..........Z I only want to print X, Y and... (1 Reply)
Discussion started by: jimmyf
1 Replies

6. Shell Programming and Scripting

Extracting numbers

Hi I am part of a academic organization and I want to send a fax to the students however there must be a quicker way to get the fax numbers extracted from the online forms they sent me. The file looks like this (numbers are fake in order to protect identity): Biochemistry Major Michael... (3 Replies)
Discussion started by: phil_heath
3 Replies

7. Shell Programming and Scripting

Extracting key/value pairs in awk

I am extracting a number of key/value pairs in awk using following: awk ' /xyz_session_id/ { n=index($0,"xyz_session_id"); id=substr($0,n+15,25); a=$4; } END{ for (ix in a) { print a } }' I don't like this Index + substr with manually calculated... (5 Replies)
Discussion started by: migurus
5 Replies

8. Shell Programming and Scripting

Multiply a row of numbers

the following is used to add numbers: echo 7 47 47 44 4 3 3 3 3 3 | awk '{ for(i=1; i<=NF;i++) j+=$i; print j; j=0 }' how do i multiply OR subtract a row of numbers using the above tactic? (8 Replies)
Discussion started by: SkySmart
8 Replies

9. Shell Programming and Scripting

Extracting data between two tag pairs

In a huge log file (43MB, 43k lines) I am trying to extract data between two tag pairs on same line and export it to a file so I can pull it into Excel for a report. One Pair is <Text>data I need</Text> Other pair follows on same line and is <TimeStamp>more data I need</TimeStamp> I would need... (2 Replies)
Discussion started by: NanookArctic
2 Replies

10. Shell Programming and Scripting

Sum of numbers in row

Need help in coding: File with several rows incl. numbers like 1 2 3 4 5 6 7 8 ... How can i build the sum of each row seperately? 10 26 ... Thx for help. Please use CODE tags as required by forum rules! (13 Replies)
Discussion started by: smitty11
13 Replies
DBIAgent::Helper(3pm)					User Contributed Perl Documentation				     DBIAgent::Helper(3pm)

NAME
POE::Component::DBIAgent::Helper - DBI Query Helper for DBIAgent SYNOPSYS
use Socket qw/:crlf/; use POE qw/Filter::Line Wheel::Run Component::DBIAgent::Helper/; sub _start { my $helper = POE::Wheel::Run ->new( Program => sub { POE::Component::DBIAgent::Helper->run($self->{dsn}, $self->{queries} ); }, StdoutEvent => 'db_reply', StderrEvent => 'remote_stderr', ErrorEvent => 'error', StdinFilter => POE::Filter::Line->new(), StdoutFilter => POE::Filter::Line->new( Literal => CRLF), StderrFilter => POE::Filter::Line->new(), ) or carp "Can't create new DBIAgent::Helper: $! "; } sub query { my ($self, $query, $package, $state, @rest) = @_; $self->{helper}->put(join '|', $query, $package, $state, @rest); } sub db_reply { my ($kernel, $self, $heap, $input) = @_[KERNEL, OBJECT, HEAP, ARG0]; # $input is either the string 'EOF' or a Storable object. } DESCRIPTION
This is our helper routine for DBIAgent. It accepts queries on STDIN, and returns the results on STDOUT. Queries are returned on a row- by-row basis, followed by a row consisting of the string 'EOF'. Each row is the return value of $sth->fetch, which is an arrayref. This row is then passed to Storable for transport, and printed to STDOUT. HOWEVER, Storable uses newlines (" ") in its serialized strings, so the Helper is designed to use the "network newline" pair CR LF as the line terminator for STDOUT. When fetch() returns undef, one final row is returned to the calling state: the string 'EOF'. Sessions should test for this value FIRST when being invoked with input from a query. Initialization The Helper has one public subroutine, called "run()", and is invoked with two parameters: The DSN An arrayref of parameters to pass to DBI->connect (usually a dsn, username, and password). The Queries. A hashref of the form Query_Name => "$SQL". See POE::Component::DBIAgent for details. BUGS
I have NO idea what to do about handling signals intelligently. Specifically, under some circumstances, Oracle will refuse to acknowledge SIGTERM (presumably since its libraries are non-reentrant) so sometimes SIGKILL is required to terminate a Helper process. AUTHOR
This module has been fine-tuned and packaged by Rob Bloodgood <robb@empire2.com>. However, most of the code came directly from Fletch <fletch@phydeaux.org>, either directly (Po:Co:DBIAgent:Queue) or via his ideas. Thank you, Fletch! However, I own all of the bugs. This module is free software; you may redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2008-01-18 DBIAgent::Helper(3pm)
All times are GMT -4. The time now is 06:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy