Posted by yawnmoth on 11/08/34 11:43
Say I have the following file - dummy.txt:
a 4treg
a sdfas
a 4egdsag
b 1111
a ergdsfg
b 1111
c waefasdf
How would I go about removing all the lines that begin with a b? I
thought the following script (which I wrote with the intention of
replacing all such lines with the empty string) would but apparently it
doesn't:
<?
$contents = file_get_contents('dummy.txt');
echo "\r\n";
echo preg_replace('/^b.*?\n/','',$contents);
?>
Any ideas?
Navigation:
[Reply to this message]
|