01-06-2010
I have nothing more to say..., just a BIG BIG THANK YOU radoulov!
Thanks for your great help
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Guys...
I am newbie to awk and would like a solution to probably one of the simple practical questions.
I have a test file that goes as:
1,2,3,4,5,6
7,2,3,8,7,6
9,3,5,6,7,3
8,3,1,1,1,1
4,4,2,2,2,2
I would like to know how AWK can get me the distinct values say for eg: on col2... (22 Replies)
Discussion started by: anduzzi
22 Replies
2. Shell Programming and Scripting
I want to remove text from nth position to nth position couple of times in same line
my line is
"hello is there anyone can help me with this question"
I need like this
ello is there anyone can help me with question
'h' is removed and 'this' removed from the line. I want to do this... (5 Replies)
Discussion started by: elamurugu
5 Replies
3. Shell Programming and Scripting
Hi
I'm looking for a way to read a text file that may contain 1000 records or more and each of these records has 460 characters. I need to read each record, and add a string of characters starting at position 256 for each record. Any suggestions using UNIX shell scripting. (4 Replies)
Discussion started by: macastor
4 Replies
4. UNIX for Advanced & Expert Users
Hello everyone,
I am writing a script to process data from the ATP world tour.
I have a file which contains:
t=540 y=2011 r=1 p=N409
t=540 y=2011 r=2 p=N409
t=540 y=2011 r=3 p=N409
t=540 y=2011 r=4 p=N409
t=520 y=2011 r=1 p=N409
t=520 y=2011 r=2 p=N409
t=520 y=2011 r=3 p=N409
The... (4 Replies)
Discussion started by: imahmoud
4 Replies
5. Shell Programming and Scripting
Hi
My file have 7 column, FIle is pipe delimed
Col1|Col2|col3|Col4|col5|Col6|Col7
I want to find out uniq record count on col3, col4 and col2 ( same order) how can I achieve it.
ex
1|3|A|V|C|1|1
1|3|A|V|C|1|1
1|4|A|V|C|1|1
Output should be
FREQ|A|V|3|2
FREQ|A|V|4|1
Here... (5 Replies)
Discussion started by: sanranad
5 Replies
6. Shell Programming and Scripting
Hi experts,
Need your help on how to insert carriage return after the 10th char position of each line in a file and then add two blank spaces after the carriage return.
Example:
>cat test.txt
testingline
dummystring
samplesample
teststringline
Expected output should be..
... (2 Replies)
Discussion started by: brichigo
2 Replies
7. Shell Programming and Scripting
Hello,
I have some tab delimited data and I need to move the last col. I could hard code it,
awk '{ print $1,$NF,$2,$3,$4,etc }' infile > outfile
but it would be nice to know the syntax to print a range cols.
I know in cut you can do,
cut -f 1,4-8,11-
to print fields 1,... (8 Replies)
Discussion started by: LMHmedchem
8 Replies
8. Shell Programming and Scripting
Hi,
Please help with this.
I have several excel files (with and .xlsx format) with 10-15 columns each.
They all have the same type of data but the columns are not ordered in the same way.
Here is a 3 column example. What I want to do add the alphabet
from column 2 to column 3, provided... (9 Replies)
Discussion started by: newbie83
9 Replies
9. Shell Programming and Scripting
Hi,
Please help, this is quite complex, I dont know how to start.
The original input files are 10mb in size each.
I have multiple files and I want to merge them in the following way.
Every file has 4 columns. Col1 and col2 are fixed with respect to each other. In the example value A... (2 Replies)
Discussion started by: alpesh
2 Replies
10. Shell Programming and Scripting
Hi,
i was tried using the awk command for replacing '-' in the second column. but the below command replacing the entire file.
cat 1.txt |awk '{gsub(/-/,"")}1'
Input file
1,2,3,-4,5,6
1,-2,3,4,5,-6
1,2,3,4,5,6
1,-2,3,4,-5,6
Output file
1,2,3,-4,5,6
1,2,3,4,5,-6
1,2,3,4,5,6... (3 Replies)
Discussion started by: onesuri
3 Replies
LEARN ABOUT OSX
dbd::gofer::transport::corostream
DBD::Gofer::Transport::corostream(3) User Contributed Perl Documentation DBD::Gofer::Transport::corostream(3)
NAME
DBD::Gofer::Transport::corostream - Async DBD::Gofer stream transport using Coro and AnyEvent
SYNOPSIS
DBI_AUTOPROXY="dbi:Gofer:transport=corostream" perl some-perl-script-using-dbi.pl
or
$dsn = ...; # the DSN for the driver and database you want to use
$dbh = DBI->connect("dbi:Gofer:transport=corostream;dsn=$dsn", ...);
DESCRIPTION
The BIG WIN from using Coro is that it enables the use of existing DBI frameworks like DBIx::Class.
KNOWN ISSUES AND LIMITATIONS
- Uses Coro::Select so alters CORE::select globally
Parent class probably needs refactoring to enable a more encapsulated approach.
- Doesn't prevent multiple concurrent requests
Probably just needs a per-connection semaphore
- Coro has many caveats. Caveat emptor.
STATUS
THIS IS CURRENTLY JUST A PROOF-OF-CONCEPT IMPLEMENTATION FOR EXPERIMENTATION.
Please note that I have no plans to develop this code further myself. I'd very much welcome contributions. Interested? Let me know!
AUTHOR
Tim Bunce, <http://www.tim.bunce.name>
LICENCE AND COPYRIGHT
Copyright (c) 2010, Tim Bunce, Ireland. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
SEE ALSO
DBD::Gofer::Transport::stream
DBD::Gofer
APPENDIX
Example code:
#!perl
use strict;
use warnings;
use Time::HiRes qw(time);
BEGIN { $ENV{PERL_ANYEVENT_STRICT} = 1; $ENV{PERL_ANYEVENT_VERBOSE} = 1; }
use AnyEvent;
BEGIN { $ENV{DBI_TRACE} = 0; $ENV{DBI_GOFER_TRACE} = 0; $ENV{DBD_GOFER_TRACE} = 0; };
use DBI;
$ENV{DBI_AUTOPROXY} = 'dbi:Gofer:transport=corostream';
my $ticker = AnyEvent->timer( after => 0, interval => 0.1, cb => sub {
warn sprintf "-tick- %.2f
", time
} );
warn "connecting...
";
my $dbh = DBI->connect("dbi:NullP:");
warn "...connected
";
for (1..3) {
warn "entering DBI...
";
$dbh->do("sleep 0.3"); # pseudo-sql understood by the DBD::NullP driver
warn "...returned
";
}
warn "done.";
Example output:
$ perl corogofer.pl
connecting...
-tick- 1293631437.14
-tick- 1293631437.14
...connected
entering DBI...
-tick- 1293631437.25
-tick- 1293631437.35
-tick- 1293631437.45
-tick- 1293631437.55
...returned
entering DBI...
-tick- 1293631437.66
-tick- 1293631437.76
-tick- 1293631437.86
...returned
entering DBI...
-tick- 1293631437.96
-tick- 1293631438.06
-tick- 1293631438.16
...returned
done. at corogofer.pl line 39.
You can see that the timer callback is firing while the code 'waits' inside the do() method for the response from the database. Normally
that would block.
perl v5.16.2 2010-12-29 DBD::Gofer::Transport::corostream(3)