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_conten ts('dummy.txt') ;
echo "\r\n";
echo preg_replace('/^b.*?\n/','',$contents) ;
?>
Any ideas?
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_conten ts('dummy.txt') ;
echo "\r\n";
echo preg_replace('/^b.*?\n/','',$contents) ;
?>
Any ideas?
Comment