hi guys,
Suppose you have 100 files in a folder and you want to replace all occurances of a word say "ABCD" in those files with "DCBA", how would you do
it ???
jatin (13 Replies)
I used the following script
cd pathname
for y in `ls *`;
do sed "s/ABCD/DCBA/g" $y > temp; mv temp $y;
done
and it worked fine for finding and replacing strings with names etc. in all files of the given path.
I'm trying to replace a string which consists of path (location of file)
... (2 Replies)
i have to search a string and replace with multiple lines.
example
Input
echo 'sample text'
echo 'college days'
output
echo 'sample text'
echo 'information on students'
echo 'emp number'
echo 'holidays'
i have to search a word college and replace the multiple lines
i have... (1 Reply)
I used the following script
cd pathname
for y in `ls *`;
do sed "s/ABCD/DCBA/g" $y > temp; mv temp $y;
done
and it worked fine for finding and replacing strings with names etc. in all files of the given path.
I'm trying to replace a string which consists of path (location of file)
... (11 Replies)
find . -type f -name "*.sql" -print|xargs perl -i -pe 's/pattern/replaced/g'
this is simple logic to find and replace in multiple files & folders
Hope this helps.
Thanks
Zaheer (0 Replies)
Hi,
I am creating a script to do a find and replace single/multiple lines in a file with any number of lines.
I have written a logic in a script that reads a reference file say "findrep" and populates two variables $FIND and $REPLACE
print $FIND gives
Hi How r $u
Rahul()
Note:... (0 Replies)
Can someone tell me how I can do this?
e.g:
a=$(echo -e wert trewt ertert ertert ertert erttert
erterte
rterter
tertertert
ert)
How do i replace the STRING with $a?
I try this:
sed -i 's/STRING/'"$a"'/g' filename.ext
but this don' t work (2 Replies)
I have a list of files all over a file system e.g.
/home/1/foo/bar.x
/www/sites/moose/foo.txtI'm looking for strings in these files and want to replace each occurrence with a replacement string, e.g.
if I find: '#@!^\&@ in any of the files I want to replace it with: 655#@11, etc.
There... (2 Replies)
Hello Guys,
I need to replace a string with multiple lines.
For eg:-
ABC,DEF,GHI,JKL,MNO,PQR,STU
need to convert the above as below:-
ABC,DEF,
GHI1
GHI2
GHI3,
JKL,MNO,
PQR1
PQR2
PQR3,
STU
i have tried using code as:- (2 Replies)
Discussion started by: jassi10781
2 Replies
LEARN ABOUT PHP
ob_end_clean
OB_END_CLEAN(3) 1 OB_END_CLEAN(3)ob_end_clean - Clean (erase) the output buffer and turn off output bufferingSYNOPSIS
bool ob_end_clean (void )
DESCRIPTION
This function discards the contents of the topmost output buffer and turns off this output buffering. If you want to further process the
buffer's contents you have to call ob_get_contents(3) before ob_end_clean(3) as the buffer contents are discarded when ob_end_clean(3) is
called.
The output buffer must be started by ob_start(3) with PHP_OUTPUT_HANDLER_CLEANABLE and PHP_OUTPUT_HANDLER_REMOVABLE flags. Otherwise
ob_end_clean(3) will not work.
RETURN VALUES
Returns TRUE on success or FALSE on failure. Reasons for failure are first that you called the function without an active buffer or that
for some reason a buffer could not be deleted (possible for special buffer).
ERRORS /EXCEPTIONS
If the function fails it generates an E_NOTICE.
EXAMPLES
The following example shows an easy way to get rid of all output buffers:
Example #1
ob_end_clean(3) example
<?php
ob_start();
echo 'Text that won't get displayed.';
ob_end_clean();
?>
SEE ALSO ob_start(3), ob_get_contents(3), ob_flush(3).
PHP Documentation Group OB_END_CLEAN(3)