Hi,
I am trying to filter the words from a file which contain 'abc'. But I am unable to. Could any one help me.
For eg: The file contents are
123ab 12hnj1 123abc456 123cgbcahjkf23 23134abchfhj43 gc32abc abc1 2abc3 sd uiguif fhwe 21242 uh123 jkcas124d123 u3hdbh23u ffsd8
Output... (3 Replies)
I have following string in a variable:
str="sstring garbage adfsdf tab.col1 lkad rjfj tab2.col2 adja tab2.col4 garbage"
I want to filter "word.word" pattern from it. I assume the pattern won't occur in start or end of the string. Output shoud be:
tab.col1 tab2.col2 tab2.col4
Can this be... (7 Replies)
hello,
i 'd like your help about a bash script which:
1. finds inside the html file (it is attached with my post) the code number of the Latest Stable Kernel,
2.finds the link which leads to the download location of the Latest Stable Kernel version,
(the right link should lead to the file... (3 Replies)
well, im a total novice of unix commands and shell scripting, i never made anything.
But yesterday in my work i was working with a lot of log files and i was wondering if there is a command for doing something like this:
i have a bunch of files with text like this:
blablabla errorcode1... (11 Replies)
Hi ,
I need to count the number of errors associated with the two words occurring in the file. It's about counting the occurrences of the word "error" for where is the word "index.js". As such the command should look like. Please kindly help. I was trying: grep "error" log.txt | wc -l (1 Reply)
Hi
I have strings like these :
Vengeance mitt
Men Vengeance gloves
Women Quatro Windstopper Etip gloves
Quatro Windstopper Etip gloves
Girls Thermobite hooded jacket
Thermobite Triclimate snow jacket
Boys Thermobite Triclimate snow jacket
and I would like to get the lower case words at... (2 Replies)
Hello,
I would like to change my setting in a file to the setting that user input.
For example, by default it is
ONBOOT=ON
When user key in "YES", it would be
ONBOOT=YES
--------------
This code only adds in the entire user input, but didn't replace it.
How do i go about... (5 Replies)
Hi
Can someone tell me which script will work best (in terms of speed and simplicity to write and run) for a large text file to filter all the lines with a minimum specified length of words ? A sample script with be definitely of great help !!! Thanks in advance. :) (4 Replies)
hi,
i need to replace all words in any quote position and then need to change the words inside the file thousand of raw.
textfile data :
"Ninguno","Confirma","JuicioABC"
"JuicioCOMP","Recurso","JuicioABC"
"JuicioDELL","Nulidad","Nosino"
"Solidade","JuicioEUR","Segundo"
need... (1 Reply)
Hi All,
I need one help to replace particular words in file based on if finds another words in that file .
i.e.
my self is peter@king.
i am staying at north sydney.
we all are peter@king.
How to replace peter to sham if it finds @king in any line of that file.
Please help me... (8 Replies)
Discussion started by: Rajib Podder
8 Replies
LEARN ABOUT PHP
array_replace_recursive
ARRAY_REPLACE_RECURSIVE(3) 1 ARRAY_REPLACE_RECURSIVE(3)array_replace_recursive - Replaces elements from passed arrays into the first array recursivelySYNOPSIS
array array_replace_recursive (array $array1, array $array2, [array $...])
DESCRIPTION array_replace_recursive(3) replaces the values of $array1 with the same values from all the following arrays. If a key from the first array
exists in the second array, its value will be replaced by the value from the second array. If the key exists in the second array, and not
the first, it will be created in the first array. If a key only exists in the first array, it will be left as is. If several arrays are
passed for replacement, they will be processed in order, the later array overwriting the previous values.
array_replace_recursive(3) is recursive : it will recurse into arrays and apply the same process to the inner value.
When the value in $array1 is scalar, it will be replaced by the value in $array2, may it be scalar or array. When the value in $array1 and
$array2 are both arrays, array_replace_recursive(3) will replace their respective value recursively.
PARAMETERS
o $array1
- The array in which elements are replaced.
o $array2
- The array from which elements will be extracted.
o $...
- Optional. More arrays from which elements will be extracted.
RETURN VALUES
Returns an array, or NULL if an error occurs.
EXAMPLES
Example #1
array_replace_recursive(3) example
<?php
$base = array('citrus' => array( "orange") , 'berries' => array("blackberry", "raspberry"), );
$replacements = array('citrus' => array('pineapple'), 'berries' => array('blueberry'));
$basket = array_replace_recursive($base, $replacements);
print_r($basket);
$basket = array_replace($base, $replacements);
print_r($basket);
?>
The above example will output:
Array
(
[citrus] => Array
(
[0] => pineapple
)
[berries] => Array
(
[0] => blueberry
[1] => raspberry
)
)
Array
(
[citrus] => Array
(
[0] => pineapple
)
[berries] => Array
(
[0] => blueberry
)
)
Example #2
array_replace_recursive(3) and recursive behavior
<?php
$base = array('citrus' => array("orange") , 'berries' => array("blackberry", "raspberry"), 'others' => 'banana' );
$replacements = array('citrus' => 'pineapple', 'berries' => array('blueberry'), 'others' => array('litchis'));
$replacements2 = array('citrus' => array('pineapple'), 'berries' => array('blueberry'), 'others' => 'litchis');
$basket = array_replace_recursive($base, $replacements, $replacements2);
print_r($basket);
?>
The above example will output:
Array
(
[citrus] => Array
(
[0] => pineapple
)
[berries] => Array
(
[0] => blueberry
[1] => raspberry
)
[others] => litchis
)
SEE ALSO array_replace(3), array_merge_recursive(3).
PHP Documentation Group ARRAY_REPLACE_RECURSIVE(3)