It kind of depends what you want to do with the list. You can certain cut down the effort in your code by not starting lots of processes, but using Variable Substitution (look in the bash manual pages), perhaps like this:-
This is not unique though. Is that a problem? We can do sneaky things with what bash calls an Associative Array (or a Hash) like this:-
Okay, so that is not sorted. is that a problem?
I hope that these tricks help.
Robin
These 2 Users Gave Thanks to rbatte1 For This Post:
Hello,
I have two files that I need to compare and print out the line from file2 that has the first 6 fields matching the first 6 fields in file1. Complicating this are the following restrictions
1. file1 is only a few thousand lines at most and file2 is greater than 2 million
2. I need to... (7 Replies)
Hello,
I have 800 or so files with 3 columns each and >10000 lines each.
For each file and each line I would like to print the maximum column number for each line. Then I would like to 'paste' each of these files together (column-wise) so that the file with expression in label '_1' is the... (6 Replies)
I am trying to loop through folders and extract the name of the lowest level subfolder
I was running the script below, it returns
/bb/bin/prd/newyork
/bb/bin/prd/london
/bb/bin/prd/tokyo
I really want
newyork
london
tokyo
I couldn't find a standard variable for the lowest level... (1 Reply)
Hi ,
i want to print the output in line by line
while read LINE
do
echo $LINE | grep UCM | egrep '(Shutdown|Unavailable)'
echo $LINE | grep SRBr | egrep '(Shutdown|Unavailable)'
echo $LINE | grep SRP| egrep '(Shutdown|Unavailable)'
echo $LINE | grep OM | grep JMS|... (7 Replies)
Hi,
I am trying to print copy percentage completion dynamically by using the script below,
#!/bin/bash
dest_size=0
orig_size=`du -sk $sourcefile | awk '{print $1}'`
while ; do
dest_size=`du -sk $destfile | awk '{print $1}'`
coyp_percentage=`echo "scale=2; $dest_size*100/$orig_size"... (4 Replies)
Hi All,
i want to write a shell script read below file line by line and want to exclude the lines which contains empty value for MOUNTPOINT field.
i am using centos 7 Operating system.
want to read below file.
# cat /tmp/d5
NAME="/dev/sda" TYPE="disk" SIZE="60G" OWNER="root"... (4 Replies)
Currently using below script but echo it print the output in two line.
Input file all-vm-final-2.txt
CEALA08893 SDDC_SCUN DS_SIO_Workload_SAPUI_UAT_01 4
CEALA09546 SDDC_SCUN DS-SIO-PD5_Workload_UAT_SP1_Flash_07 4
CEALA09702 SDDC_SCUN DS-VSAN-RMP-WORKLOAD01 4
DEALA08762 SDDC_LDC... (3 Replies)
Discussion started by: ranjancom2000
3 Replies
LEARN ABOUT DEBIAN
io::async::detachedcode
IO::Async::DetachedCode(3pm) User Contributed Perl Documentation IO::Async::DetachedCode(3pm)NAME
"IO::Async::DetachedCode" - execute code asynchronously in child processes
SYNOPSIS
This object is used indirectly via the "IO::Async::Loop"'s "detach_code" method.
use IO::Async::Loop;
my $loop = IO::Async::Loop->new;
my $code = $loop->detach_code(
code => sub {
my ( $number ) = @_;
return is_prime( $number );
}
);
$code->call(
args => [ 123454321 ],
on_return => sub {
my $isprime = shift;
print "123454321 " . ( $isprime ? "is" : "is not" ) . " a prime number
";
},
on_error => sub {
print STDERR "Cannot determine if it's prime - $_[0]
";
},
);
$loop->run;
DESCRIPTION
This object class provides a legacy compatibility layer for existing code that tries to construct such an object. It should not be used for
new code; see instead the IO::Async::Function object, for which this is now a wrapper.
CONSTRUCTOR
$code = $loop->detach_code( %params )
This function returns a new instance of a "IO::Async::DetachedCode" object. The %params hash takes the following keys:
code => CODE
A block of code to call in the child process.
stream
marshaller
These arguments are no longer used; any values passed will be ignored.
workers => INT
Optional integer, specifies the number of parallel workers to create.
If not supplied, 1 is used.
exit_on_die => BOOL
setup => ARRAY
Passed through to the underlying "IO::Async::Function" object.
METHODS
$code->call( %params )
Calls one invocation of the contained function code block. See the "call" method on "IO::Async::Function" for more detail.
$code->shutdown
This method requests that the detached worker processes stop running.
$n_workers = $code->workers
This method in scalar context returns the number of workers currently running.
@worker_pids = $code->workers
This method in list context returns a list of the PID numbers of all the currently running worker processes.
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
perl v5.14.2 2012-10-24 IO::Async::DetachedCode(3pm)