we had a power outage shortly after i registered...
so my mail server was down for a while...
could i get the email confirmation for hackware --> resent please...?
thanx...
...william.o.yates...email removed (3 Replies)
Hi All,
I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text.
An example of 4 lines in my file is:
1. MatchText_randomNumberOfText moreData ReplaceMe moreData
2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Hi,
I was writing a simple web application using Perl -CGI. When users try to do some operations, I wanted like a pop-up confirmation box. Is this possible with Perl-CGI?
Thanks in advance.
Regards,
garric (6 Replies)
Hello,
I really would appreciate some help with a bash script for some string manipulation on an SQL dump:
I'd like to be able to rename "sites/WHATEVER/files" to "sites/SOMETHINGELSE/files" within the sql dump.
This is quite easy with sed:
sed -e... (1 Reply)
from one script invoke another script will need to do double confirmation like: 'y' and 'y'
exp:
echo 'y' | /a/b/c.sh
only input 1 'y' in the c.sh, but the c.sh required 2 'y' (twice confirmation)
is there anyway get resolve this issue?
please help (2 Replies)
Hi All,
While am deleting a file in unix by using the command rm it's deleting the file directly
IT's have to ask the user while deleting like
do you want to delete filename y or N ?
Kindly help on this.
Thanks
Thelak (2 Replies)
Dear All,
i want to search particular string and want to replance next line value.
following is the test file.
search string is
tmp,???
,10:1 "???" may contain any 3 character it should remain the same and next line replace with ,10:50
tmp,123 --- if match tmp,??? then... (3 Replies)
Hi all,
I am editing a config file in vi that has a / on it.
At the moment, search and replace looks alright as am able to use a # as a temporary separator, i.e. :,$s#/u01/app#/u02/app#g
For doing a search, I have to escape the / do. So if I want to search for /u01/app, I am having to do... (2 Replies)
Hi Team,
I am new to unix, please help me in this.
I have a file named properties.
The content of the file is :
##Mobile props
east.url=https://qa.east.corp.com/prop/end
west.url=https://qa.west.corp.com/prop/end
south.url=https://qa.south.corp.com/prop/end... (2 Replies)
Discussion started by: tolearn
2 Replies
LEARN ABOUT PHP
substr_replace
SUBSTR_REPLACE(3) 1 SUBSTR_REPLACE(3)substr_replace - Replace text within a portion of a stringSYNOPSIS
mixed substr_replace (mixed $string, mixed $replacement, mixed $start, [mixed $length])
DESCRIPTION substr_replace(3) replaces a copy of $string delimited by the $start and (optionally) $length parameters with the string given in $replace-
ment.
PARAMETERS
o $string
- The input string. An array of strings can be provided, in which case the replacements will occur on each string in turn. In
this case, the $replacement, $start and $length parameters may be provided either as scalar values to be applied to each input
string in turn, or as arrays, in which case the corresponding array element will be used for each input string.
o $replacement
- The replacement string.
o $start
- If $start is positive, the replacing will begin at the $start'th offset into $string. If $start is negative, the replacing will
begin at the $start'th character from the end of $string.
o $length
- If given and is positive, it represents the length of the portion of $string which is to be replaced. If it is negative, it rep-
resents the number of characters from the end of $string at which to stop replacing. If it is not given, then it will default to
strlen( $string ); i.e. end the replacing at the end of $string. Of course, if $length is zero then this function will have the
effect of inserting $replacement into $string at the given $start offset.
RETURN VALUES
The result string is returned. If $string is an array then array is returned.
EXAMPLES
Example #1
Simple substr_replace(3) examples
<?php
$var = 'ABCDEFGH:/MNRPQR/';
echo "Original: $var<hr />
";
/* These two examples replace all of $var with 'bob'. */
echo substr_replace($var, 'bob', 0) . "<br />
";
echo substr_replace($var, 'bob', 0, strlen($var)) . "<br />
";
/* Insert 'bob' right at the beginning of $var. */
echo substr_replace($var, 'bob', 0, 0) . "<br />
";
/* These next two replace 'MNRPQR' in $var with 'bob'. */
echo substr_replace($var, 'bob', 10, -1) . "<br />
";
echo substr_replace($var, 'bob', -7, -1) . "<br />
";
/* Delete 'MNRPQR' from $var. */
echo substr_replace($var, '', 10, -1) . "<br />
";
?>
Example #2
Using substr_replace(3) to replace multiple strings at once
<?php
$input = array('A: XXX', 'B: XXX', 'C: XXX');
// A simple case: replace XXX in each string with YYY.
echo implode('; ', substr_replace($input, 'YYY', 3, 3))."
";
// A more complicated case where each replacement is different.
$replace = array('AAA', 'BBB', 'CCC');
echo implode('; ', substr_replace($input, $replace, 3, 3))."
";
// Replace a different number of characters each time.
$length = array(1, 2, 3);
echo implode('; ', substr_replace($input, $replace, 3, $length))."
";
?>
The above example will output:
A: YYY; B: YYY; C: YYY
A: AAA; B: BBB; C: CCC
A: AAAXX; B: BBBX; C: CCC
NOTES
Note
This function is binary-safe.
SEE ALSO str_replace(3), substr(3), String access and modification by character.
PHP Documentation Group SUBSTR_REPLACE(3)