I am trying to delete range of line numbers using sed command within php using exec command. I know how to use sed when substituting values directly within command.
exec("sed -i.bak -e '2d;12,17d;57d' $filename", $outputArray);
Note: the range will be chosen by the user and hence directly using the above command will not help me; it should be a variable.
For example, I want something like this:
<?php
$delete_from_line=35;
$delete_to_line=40;
exec("sed -i.bak -e "$delete_from_line,$delete_to_line" $filename", $outputArray);
?>
dto delete a line withsed.