Hi,
I want to read file multiple times. Right now i am using while loop but that is not working.
ex.
First while loop running 10 times but inter while loop is only executed 1 time , 2nd time it is not reading same file. I assume that is because same file already looped. want to overcome this issue.
Please suggest some solution.
Thanks,
Mallik.
Last edited by Franklin52; 10-09-2013 at 11:04 AM..
Reason: Please use code tags
Please forgive this I think rather basic question.
I have been away from UNIX for a very long time and am in need of some help.
I need to be able to check for the existance of a specific file name say 'file.dat' in a particular location
If the file exists then run a second process (at... (2 Replies)
#!/bin/sh
count=0
for i in 2 4 6
do
echo "i is $i"
count='expr $count + 1'
done
echo "The loop was executed $count times"
with these scripts
my output is :
i is 2
i is 4
i is 6
The loop was executed expr $count + 1 times
What should I do to get the value instead of 'expr... (17 Replies)
Hi Experts,
I have a code like this.
=====
#include....
int main()
{
int count = 0;
while(1){
printf("\n Interation number is: %d \n ",count);
rv = system(" test.sh > log.txt " );
if (-1 == rv)
{
printf("Could not generate static log: error... (12 Replies)
Is there any FASTEST way to loop a script 10k times
my script works likes this
c-randomnumbers-script -i input1.bed -g g19 -e DB >> output1
I need to run this 10k times by using consecutive outputs to get my final output i.e, output10000
c-random-script -i input1.bed -g g19 -e DB >>... (5 Replies)
Hi
Am trying to print the PIDs of process in a file and trying to grep any PID from that file
I set the if condition as $value != "PID" and $value != "-"
Assign that number to a variable
Am confused since am using while loop to read the line from file
and again if condition to check those... (2 Replies)
Hi Fellows,
I was wondering how I can remove first few characters from multiple file names without do loop in unix?
e.g.
water123.xyz
water456.xyz
to
123.xyz
456.xyz
Thanks
Paul
Thanks. (3 Replies)
hi, i am running a java script on few thousand files (e1.rnk....en.rnk) but manually,. is there any way to run it automatically by changing the output directory (-out) ?
thanx in advance
ex:
java -jar commands -res /path/e1.rnk -out /path/e1 -gui false
java -jar commands -res /path/e2.rnk... (1 Reply)
hdr=$(cut -c1 $path$file|head -1)#extract header”H”
trl=$(cut -c|path$file|tail -1)#extract trailer “T”
SplitFile=$(cut -c 50-250 $path 1$newfile |sed'$/ *$//' head -1')# to trim white space and extract table name
If; then # start loop if it is a header
While read I #read file
Do... (4 Replies)
After the successful start of server, it should check the status again, if it is not running ,it should go through the loop for 2 times.
Even after two times of execution if still the server is not running it should send an alert email. Please help (1 Reply)
hi,
I am using hp unix server and not getting variable output present inside the while loop. I have tried changing the code and need to verify whether it is proper practice of code. I am expecting the output of varible RUN_FILE 3 to TRUE which i get inside the while loop.
RUN_FILE 1=TRUE... (8 Replies)
Discussion started by: gowthamsoft
8 Replies
LEARN ABOUT DEBIAN
io::async::test
IO::Async::Test(3pm) User Contributed Perl Documentation IO::Async::Test(3pm)NAME
"IO::Async::Test" - utility functions for use in test scripts
SYNOPSIS
use Test::More tests => 1;
use IO::Async::Test;
use IO::Async::Loop;
my $loop = IO::Async::Loop->new;
testing_loop( $loop );
my $result;
$loop->do_something(
some => args,
on_done => sub {
$result = the_outcome;
}
);
wait_for { defined $result };
is( $result, what_we_expected, 'The event happened' );
...
my $buffer = "";
my $handle = IO::Handle-> ...
wait_for_stream { length $buffer >= 10 } $handle => $buffer;
is( substr( $buffer, 0, 10, "" ), "0123456789", 'Buffer was correct' );
DESCRIPTION
This module provides utility functions that may be useful when writing test scripts for code which uses "IO::Async" (as well as being used
in the "IO::Async" test scripts themselves).
Test scripts are often synchronous by nature; they are a linear sequence of actions to perform, interspersed with assertions which check
for given conditions. This goes against the very nature of "IO::Async" which, being an asynchronisation framework, does not provide a
linear stepped way of working.
In order to write a test, the "wait_for" function provides a way of synchronising the code, so that a given condition is known to hold,
which would typically signify that some event has occured, the outcome of which can now be tested using the usual testing primitives.
Because the primary purpose of "IO::Async" is to provide IO operations on filehandles, a great many tests will likely be based around
connected pipes or socket handles. The "wait_for_stream" function provides a convenient way to wait for some content to be written through
such a connected stream.
FUNCTIONS
testing_loop( $loop )
Set the "IO::Async::Loop" object which the "wait_for" function will loop on.
wait_for( $condfunc )
Repeatedly call the "loop_once" method on the underlying loop (given to the "testing_loop" function), until the given condition function
callback returns true.
To guard against stalled scripts, if the loop indicates a timeout for 10 consequentive seconds, then an error is thrown.
wait_for_stream( $condfunc, $handle, $buffer )
As "wait_for", but will also watch the given IO handle for readability, and whenever it is readable will read bytes in from it into the
given buffer. The buffer is NOT initialised when the function is entered, in case data remains from a previous call.
$buffer can also be a CODE reference, in which case it will be invoked being passed data read from the handle, whenever it is readable.
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
perl v5.14.2 2012-10-24 IO::Async::Test(3pm)