11-04-2010
Thank You for your reply - It worked.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Been struggling with a problem, I have been trying to do this in awk, but am unable to figure this out, I think arrays have to be used, but unsure how to accomplish this.
I have a input file that looks like this:
141;ny;y;g
789;ct;e;e
23;ny;n;u
45;nj;e;u
216;ny;y;u
7;ny;e;e
1456;ny;e;g... (3 Replies)
Discussion started by: craigsky
3 Replies
2. Shell Programming and Scripting
now its owkring - thanks fo rthe help all . (7 Replies)
Discussion started by: fusionX
7 Replies
3. Shell Programming and Scripting
Hi, I've written the following code to manipulate the first 40 lines of a data file into my desired order:
#!/bin/awk -f
{ if (NR<=(4)){
a=a$0" "}
else { if ((NR >= (5)) && (NR <= (13))) {
b=b$0" " }
else {if ((NR >= (14)) && (NR <= (25))){
c=c$0" "}
... (5 Replies)
Discussion started by: catwoman
5 Replies
4. UNIX for Dummies Questions & Answers
Hi All,
I have a problem assigning variables to script.I have a script in which i have a while loop now i have to assign some values obtained to an array which will be used later in the script.Can anyone help how to do that.
At present my scrot looks like:
co=0
pco=0
co=`cat /tmp/highcpu... (4 Replies)
Discussion started by: usha rao
4 Replies
5. Shell Programming and Scripting
Hi,
I have the following data in a file for example:
Name="Fred","Bob","Peterson","Susan","Weseley"
Age="24","30","28","23","45"
Study="English","Engineering","Physics","Maths","Psychology"
Code="0","0","1","1","0"
Name="Fred2","Bob2","Peterson2","Susan2","Weseley2"... (14 Replies)
Discussion started by: james2009
14 Replies
6. UNIX for Dummies Questions & Answers
Okay, I've made threads on extracting fields and comparing strings in separate files in .csv's. I've written the following code with intentions of learning more.
I just want this one question answered: How can I assign fields from a file(comma separated) to variables?
My goal is to check... (0 Replies)
Discussion started by: chickeneaterguy
0 Replies
7. Shell Programming and Scripting
I'm a little stuck and would be grateful of some advice!
I have three files, two of which contain reference data that I want to add to a line of output in the third file. I can't seem to get awk to print array contents as I would expect.
The input files are:
# Input file
AAA,OAA,0313... (2 Replies)
Discussion started by: maccas17
2 Replies
8. Shell Programming and Scripting
So I'm back once again beating my head off a wall trying to figure out how to get this to work.
My end goal is to take input such as what's below, which will be capture in real time with a tail -f from a file or piped output from another command:
... (5 Replies)
Discussion started by: ShadowBlade72
5 Replies
9. Shell Programming and Scripting
Sometimes it is handy to protect long scripts in C++.
The following syntax works fine for simple commands:
#define SHELLSCRIPT1 "\
#/bin/bash \n\
echo \"hello\" \n\
"
int main ()
{
cout <<system(SHELLSCRIPT1);
return 0;
}
Unfortunately for there are problems for:
1d arrays:... (10 Replies)
Discussion started by: frad
10 Replies
10. Shell Programming and Scripting
Trying to do so
echo "111:222:333" |awk -F: '{system("export TESTO=" $2)}'But it doesn't work (2 Replies)
Discussion started by: urello
2 Replies
LEARN ABOUT PHP
array_merge_recursive
ARRAY_MERGE_RECURSIVE(3) 1 ARRAY_MERGE_RECURSIVE(3)
array_merge_recursive - Merge two or more arrays recursively
SYNOPSIS
array array_merge_recursive (array $array1, [array $...])
DESCRIPTION
array_merge_recursive(3) merges the elements of one or more arrays together so that the values of one are appended to the end of the previ-
ous one. It returns the resulting array.
If the input arrays have the same string keys, then the values for these keys are merged together into an array, and this is done recur-
sively, so that if one of the values is an array itself, the function will merge it with a corresponding entry in another array too. If,
however, the arrays have the same numeric key, the later value will not overwrite the original value, but will be appended.
PARAMETERS
o $array1
- Initial array to merge.
o $...
- Variable list of arrays to recursively merge.
RETURN VALUES
An array of values resulted from merging the arguments together.
EXAMPLES
Example #1
array_merge_recursive(3) example
<?php
$ar1 = array("color" => array("favorite" => "red"), 5);
$ar2 = array(10, "color" => array("favorite" => "green", "blue"));
$result = array_merge_recursive($ar1, $ar2);
print_r($result);
?>
The above example will output:
Array
(
[color] => Array
(
[favorite] => Array
(
[0] => red
[1] => green
)
[0] => blue
)
[0] => 5
[1] => 10
)
SEE ALSO
array_merge(3), array_replace_recursive(3).
PHP Documentation Group ARRAY_MERGE_RECURSIVE(3)