Hi,
Is it possible to create a dynamic array in shell script. I am trying to get the list of logfiles that created that day and put it in a dynamic array. I am not sure about it. help me
New to scripting
Gundu (3 Replies)
i want to create an array
the array elements are populated depending upon the number of entries present in a data file
The data file is created dynamically
how to achieve the same
thanks (1 Reply)
I am facing a strange error while creating posix threads:
Given below are two snippets of code, the first one works whereas the second one gives a garbage value in the output.
Snippet 1
This works:
--------------
int *threadids;
threadids = (int *) malloc (num_threads * sizeof(int));
... (4 Replies)
I am wondering how I can save the file names (stored in $file or $fnames) in array which I can access with an index.
alias MATH 'set \!:1 = `echo "\!:3-$" | bc -l`'
set narg = $#argv
while ($iarg < $narg)
MATH iarg = $iarg + 1
set arg = $argv
set opt = ` echo $arg | awk... (1 Reply)
I have an interesting requirement. I have declaried an array like :-
arr=`find . ! -name "." | xargs -I {} echo {} | cut -c 2-${#}`
Then i will try to access the array elements like :-
i=0
for i in ${arr}; do
Here comes the confusions, the array elements are basically dir and files stored... (2 Replies)
Hi gurus,
I need to create arrays from variables, via a loop.
The issue I have is with the array name creation. How do I use a variable to define an array?
I want to do something like
declare -a $H
where $H is my loop variable.
I then need to add items to each array I've created,... (3 Replies)
I am having trouble creating an array, I've tried everything google gives me but it won't work, and it seems as though it should. Using Ubunto 12.04 and bash.
#!/bin/bash
ARRAY=one two three
echo ${ARRAY}When I do this I receive the error
: two: not found
and
: Bad substitution
When I... (3 Replies)
Dear community,
how can I create an array from file taking only the 4th field?
out.txt file is something like this:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20So the final array should be:
4 8 12 16 20With this command I created an array with all the fields, but I need only the 4th... (13 Replies)
Hi Guys,
I am writting a c shell script where I have to parse an input argument with options that could be an array. So far I have achieved where I could parse a single argument with option but failed when I try to create an array with the options. For example:
This is on terminal window:... (2 Replies)
Discussion started by: dixits
2 Replies
LEARN ABOUT DEBIAN
posix::strptime
POSIX::strptime(3pm) User Contributed Perl Documentation POSIX::strptime(3pm)NAME
POSIX::strptime - Perl extension to the POSIX date parsing strptime(3) function
SYNOPSIS
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = POSIX::strptime("string", "Format");
DESCRIPTION
Perl interface to strptime(3)FUNCTIONS
strptime
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = POSIX::strptime(string, format);
The result for any value not extracted is not defined. Some platforms may reliably return "undef", but this is dependent on the
strptime(3) function in the underlying C library.
For example, only the following fields may be relied upon:
my ($min, $hour) = ( POSIX::strptime( "01:23", '%H:%M' ) )[1,2];
my ($mday, $mon, $year) = ( POSIX::strptime( "2010/07/16", '%Y/%m/%d' ) )[3,4,5];
Furthermore, not all platforms will set the $wday and $yday elements. If these values are required, use "mktime" and "gmtime":
use POSIX qw( mktime );
use POSIX::strptime qw( strptime );
my ($mday, $mon, $year) = ( POSIX::strptime( "2010/07/16", '%Y/%m/%d' ) )[3,4,5];
my $wday = ( gmtime mktime 0, 0, 0, $mday, $mon, $year )[6];
SEE ALSO strptime(3)AUTHOR
Philippe M. Chiasson <gozer@cpan.org> Kim Scheibel <kim@scheibel.co.uk>
REPOSITORY
http://svn.ectoplasm.org/projects/perl/POSIX-strptime/trunk/
COPYRIGHT
Copyright 2005 by Philippe M. Chiasson <gozer@cpan.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
perl v5.14.2 2010-07-16 POSIX::strptime(3pm)