Hi,
I want to replace a word in a file which occurs after a particular word.
For example :
$cat file.txt
CASE
WHEN
AND c1 = 'I'
AND c2= '2'
THEN 1
WHEN
AND c1= 'I'
AND c2= '0'
THEN 2
So in this example i want to replace... (4 Replies)
Hi All,
I have a file in which a number of lines are starting with similar first word but different next words.
I want to replace the any nth word(not 1st or 2nd) with another word.
Eg:- My file contains are like this:-
Ram is a boy.
Ram is a good boy.
Ram plays cricket.
Here I want to... (2 Replies)
Hi Everyone,
I am looking for a simple way for replacing all the files under a directory that use the server "xsgd1234dap" with "xsdr3423pap".
For Example:
In the Directory,
$pwd
/home/nick
$ grep -l "xsgd1234dap" *.sh | wc -l
119
I have "119" files that are still using... (5 Replies)
Hi Everybody,
I am having a query like I want to change only first three patterns of the first line in a file.
ex: I like unix unix unix unix is very much.
after using the command it should be like
I like linux linux linux unix is very much.
Thanks,
Naga (3 Replies)
Hello,
I want to add a sentence to "post column" those who are only less than 30 characters.Thank you very much for your help.
"category","title","post"
"Z","Zoo","test 54325 test 45363mc."
"Z","Zen","rs2w3rsj 2d342dg 2d3s4f23 d23423s23h 2s34s2423g ds232d34 2342."
"Z","Zet","test4444... (3 Replies)
Hi All,
I have a XML file which is looks like as below. <<please see the attachment >>
<?xml version="1.0" encoding="UTF-8"?>
<esites>
<esite>
<name>XXX.com</name>
<storeId>10001</storeId>
<module>
... (4 Replies)
Hi,
This should be really simple. But not sure why I am unable to crack it.
I am looking for a simple one liner to print every alternate word in a csv. say my file is having content :
abc,def,ghi,jkl,.....
i need the output as below
abc
ghi (7 Replies)
STREAM_CONTEXT_CREATE(3) 1 STREAM_CONTEXT_CREATE(3)stream_context_create - Creates a stream contextSYNOPSIS
resource stream_context_create ([array $options], [array $params])
DESCRIPTION
Creates and returns a stream context with any options supplied in $options preset.
PARAMETERS
o $options
- Must be an associative array of associative arrays in the format $arr['wrapper']['option'] = $value. Default to an empty array.
o $params
- Must be an associative array in the format $arr['parameter'] = $value. Refer to context parameters for a listing of standard
stream parameters.
RETURN VALUES
A stream context resource.
CHANGELOG
+--------+---------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------+
| 5.3.0 | |
| | |
| | Added the optional $params argument. |
| | |
+--------+---------------------------------------+
EXAMPLES
Example #1
Using stream_context_create(3)
<?php
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en
" .
"Cookie: foo=bar
"
)
);
$context = stream_context_create($opts);
/* Sends an http request to www.example.com
with additional headers shown above */
$fp = fopen('http://www.example.com', 'r', false, $context);
fpassthru($fp);
fclose($fp);
?>
SEE ALSO stream_context_set_option(3), Listing of supported wrappers ("Supported Protocols and Wrappers"), Context options ("Context options and
parameters").
PHP Documentation Group STREAM_CONTEXT_CREATE(3)