Re: Spliting file and save it with date...

"Cameron Simpson [email protected] [sed-users]" <[email protected]> Tue, 19 Sep 2017 09:30:04 +1000
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
On 18Sep2017 16:09, Daniel Goldman <[email protected]> wrote:
>"well, a bash script solution might be fancy here. It is slow but rather
> easy to configure:"
> I agree with the basic idea. Parsing the data with a bash script is a 
> reasonable solution, and not that difficult. However, when I run the script, 
> I get an error.
[...]
> $ ./script.sh
>./script.sh: line 11: ?php: No such file or directory
>./script.sh: line 11: ?php: No such file or directory
>
> On the face of it, seems the bash script ends up interpreting "<?php" as trying to read input from "?php" file... One simple solution would be to just get rid of those lines before processing the file, and key on the $date lines as the start of each record.

And we're back to my core problem with this approach: even debugging the script 
opens you up to arbitrary code execution. You just had your input file run 
_unexpected shell commands_ !!! Using known "clean" input data.

Please guys, I know it's all very cool to write compact one liners which 
generate shell code to do the file opening, but this is asking to shoot 
yourself in the foot.

Cheers,
Cameron Simpson <[email protected]> (formerly [email protected])