10-19-2008
You are using the %f format to scanf, but storing to an (int). (%f requires a (double) to receive the result. GNU C with -Wformat would warn you of this mistake.)
8 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Folks!
Can you help me with this find -printf command. I seem to be unable to execute the printf-command from my shell script. I'm confused: :confused:
My shell script snippet looks like this:
#!/bin/sh
..
COMMAND="find ./* -printf '%p %m %s %u %g \n'"
echo "Command: ${COMMAND}"... (1 Reply)
Discussion started by: grahamb
1 Replies
2. Shell Programming and Scripting
Hi
I'm using awk to manipulate the data in the 6th field of the file xxx_yyy.hrv.
The sample data that is available in this field is given below
220731.7100000000000000
When i tried using this command
cat xxx_yyy.hrv | awk '{printf("%23.16f\n",$6*-1)}'
I get the output as... (4 Replies)
Discussion started by: angelarosh
4 Replies
3. Programming
Hi ,
I wonder if in java I can pipe the below output of the printf into a variable:
System.out.printf(" This is a test %s\n", myVariable);
I want to keep the output of the printf command to create my history array.
Thanks. (2 Replies)
Discussion started by: arizah
2 Replies
4. Shell Programming and Scripting
printf "%X\n" "A"
41
printf "%X\n" "2"
2
Expected 32 (not 2).
Is there a "printf" which will output the hexadecimal value of a numeric character? (9 Replies)
Discussion started by: methyl
9 Replies
5. Shell Programming and Scripting
Hi,
i have a script, which is incomplete, am on my way developing it.
Input
1,12,2012,IF_TB001
2,12,2012,3K3
3,Z56,00000,25,229,K900,00, ,3G3, ,USD, ,0000000000,000, , , , 550000000
3,Z56,00000,53,411,W225,00,000, , ,USD,OM170,0000000000,000, , , , -550000000
4,Z56,COUNT, 4,SUM LOC,... (19 Replies)
Discussion started by: selvankj
19 Replies
6. Shell Programming and Scripting
Hi All;
I try to create a excel like table with headers and some fields containing values, other long and complex mathematic formulas.
I have some header like : Name Formula Value True/False
Under name column, they are some formula names, formula column some long mathematic formulas... (9 Replies)
Discussion started by: reseki
9 Replies
7. Shell Programming and Scripting
Hello script guru's
as i write more and more code i always block at managing output... either writing to standard out, writing to files via std out (log, temp file, etc). Don't get me wrong 99% of the time it DOES the job but maybe there is more efficient.
I'm writing a small script to... (2 Replies)
Discussion started by: maverick72
2 Replies
8. UNIX for Beginners Questions & Answers
So I created two shell variables: COLUMN1_HEADING, COLUMN2_HEADING.
They have values:
COLUMN1_HEADING="John"
COLUMN2_HEADING="123456789"
How would I use printf to get it to print an output like this: $COLUMN1_HEADING\t$COLUMN2_HEADING\nJohn\t123456789\n
Thanks! (3 Replies)
Discussion started by: steezuschrist96
3 Replies
LEARN ABOUT DEBIAN
anyevent::dbd::pg
AnyEvent::DBD::Pg(3pm) User Contributed Perl Documentation AnyEvent::DBD::Pg(3pm)
NAME
AnyEvent::DBD::Pg - AnyEvent interface to DBD::Pg's async interface
SYNOPSIS
use AnyEvent::DBD::Pg;
my $adb = AnyEvent::DBD::Pg->new('dbi:Pg:dbname=test', user => 'pass', {
pg_enable_utf8 => 1,
pg_server_prepare => 0,
quote_char => '"',
name_sep => ".",
}, debug => 1);
$adb->queue_size( 4 );
$adb->debug( 1 );
$adb->connect;
$adb->selectcol_arrayref("select pg_sleep( 0.1 ), 1", { Columns => [ 1 ] }, sub {
my $rc = shift or return warn;
my $res = shift;
warn "Got <$adb->{qd}> = $rc / @{$res}";
$adb->selectrow_hashref("select data,* from tx limit 2", {}, sub {
my $rc = shift or return warn;
warn "Got $adb->{qd} = $rc [@_]";
});
});
$adb->execute("update tx set data = data;",sub {
my $rc = shift or return warn;
warn "Got exec: $rc";
#my $st = shift;
#$st->finish;
});
$adb->execute("select from 1",sub {
shift or return warn;
warn "Got $adb->{qd} = @_";
});
$adb->selectrow_array("select pg_sleep( 0.1 ), 2", {}, sub {
shift or return warn;
warn "Got $adb->{qd} = [@_]";
$adb->selectrow_hashref("select * from tx limit 1", {}, sub {
warn "Got $adb->{qd} = [@_]";
$adb->execute("select * from tx", sub {
my $rc = shift or return warn;
my $st = shift;
while(my $row = $st->fetchrow_hashref) { warn "$row->{id}"; }
$st->finish;
exit;
});
});
});
AE::cv->recv;
METHODS
connect()
Establish connection to database
selectrow_array( $query, [\%args], $cb->( $rc, ... ))
Execute PG_ASYNC prepare, than push result of "fetchrow_array" into callback
selectrow_arrayref( $query, [\%args], $cb->( $rc, @row ))
Execute PG_ASYNC prepare, than push result of "fetchrow_arrayref" into callback
selectrow_hashref( $query, [\%args], $cb->( $rc, \%row ))
Execute PG_ASYNC prepare, than push result of "fetchrow_hashref" into callback
selectall_arrayref( $query, [\%args], $cb->( $rc, @rows ))
Execute PG_ASYNC prepare, than push result of "fetchall_arrayref" into callback
selectall_hashref( $query, [\%args], $cb->( $rc, @rows ))
Execute PG_ASYNC prepare, than push result of "fetchall_hashref" into callback
selectcol_arrayref( $query, { Columns => [...], ... }, $cb->( $rc, @rows ))
Execute PG_ASYNC prepare, than push result of "fetchall_hashref($args{Columns})" into callback
execute( $query, [\%args], $cb->( $rc, $sth ))
Execute PG_ASYNC prepare, than invoke callback, pushing resulting sth to it.
Please, note: result already passed as first argument
AUTHOR
Mons Anderson, "<mons@cpan.org>"
LICENSE AND COPYRIGHT
Copyright 2010 Mons Anderson.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as
published by the Free Software Foundation; or the Artistic License.
perl v5.10.1 2010-11-30 AnyEvent::DBD::Pg(3pm)