Hi Jotne,
thanks for the reply. The below will work for korn shell for appending one array to another array. The second array can be one already formed array with values or it can be list of values to be appended to first array (in OR part)
hope, this helps.
thanks,
All ..
I am having a pointer array . And trying to store the addess into that pointer array . please see below the problem i faced
code:
int cnt1;
char *t_array;
char *f_array;
for(cnt1=0; cnt1<1000; cnt1++)
{
t_array =... (1 Reply)
Hi All,
I need some help with arrays. I need to take input from the user for hostname, username and password until he enters .(dot) or any other character and store the values in the variable array.
I would further connect to the hostname using username and passwd and copy files from server to... (7 Replies)
Hi all,
I am new to Linux/shell scripting having moderate knowledge.
In my script, I need to get execution time of a command (say 'ls') in mili seconds level. For this i tried using "time" command to retrieve the total execution time in milli seconds. But, the problem is that, how to save... (9 Replies)
Hello Guys,
I am trying to store output of command to an array and then want to print, but it showing an error that "bad substitution". I am not getting why it's happening.
Can anyone help me?
#!/usr/bin/sh
hr=0
min=0
i=1
last $1 | grep -w `date "+%b"` | grep -v '\(0:.*\)' | grep -vw sshd... (8 Replies)
I am trying to get userinput from stdin and store the lines in an array.
If i do this:
using a char **list to store strings
allocate memory to it
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv)
{
char *prog = argv;
char **linelist;
int... (5 Replies)
Hi
I am trying to store the output of a command into an array in perl script.
I am able to store but the problem is i am unable to print the array line with one line space. i mean i inserted the \n in loop ...but not getting the result.
I have written like this
#!/usr/bin/perl
@a =... (2 Replies)
Hi,
My aim is to get the md5 hash of a file and store it in a variable.
var1="md5sum file1"
$var1
The above outputs fine but also contains the filename, so somthing like this 243ASsf25 file1
i just need to get the first part and put it into a variable.
var1="md5sum file1"... (5 Replies)
Hi All,
I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise.
Eg :
Select 'Query 1 output' from dual;
Select 'Query 2 output' from dual;
I want to... (3 Replies)
Hi Community,
Would love to get some quick help on below requirement.
I am trying to process mpstat output from multiple blades of my server
I would like to assign this the output to an array and then use it for post processing. How can I use a two dimensional array and assign these value
... (23 Replies)
Discussion started by: sshark
23 Replies
LEARN ABOUT PHP
array_pad
ARRAY_PAD(3) 1 ARRAY_PAD(3)array_pad - Pad array to the specified length with a valueSYNOPSIS
array array_pad (array $array, int $size, mixed $value)
DESCRIPTION array_pad(3) returns a copy of the $array padded to size specified by $size with value $value. If $size is positive then the array is
padded on the right, if it's negative then on the left. If the absolute value of $size is less than or equal to the length of the $array
then no padding takes place. It is possible to add at most 1048576 elements at a time.
PARAMETERS
o $array
- Initial array of values to pad.
o $size
- New size of the array.
o $value
- Value to pad if $array is less than $size.
RETURN VALUES
Returns a copy of the $array padded to size specified by $size with value $value. If $size is positive then the array is padded on the
right, if it's negative then on the left. If the absolute value of $size is less than or equal to the length of the $array then no padding
takes place.
EXAMPLES
Example #1
array_pad(3) example
<?php
$input = array(12, 10, 9);
$result = array_pad($input, 5, 0);
// result is array(12, 10, 9, 0, 0)
$result = array_pad($input, -7, -1);
// result is array(-1, -1, -1, -1, 12, 10, 9)
$result = array_pad($input, 2, "noop");
// not padded
?>
SEE ALSO array_fill(3), range(3).
PHP Documentation Group ARRAY_PAD(3)