shell pipe "loses" parts of the data, was: help needed to debug Perl script
Ken D'Ambrosio
ken at jots.org
Wed Oct 17 17:20:35 UTC 2018
One thing that's bitten me when reading from files (but not sure about
pipes) is failing to close() the file before assuming I'm done reading.
Bytes were left behind on the table, so to speak.
$.02,
-Ken
On 2018-10-17 13:05, Ralf Mardorf via ubuntu-users wrote:
> On Wed, 17 Oct 2018 18:36:18 +0200, M. Fioretti wrote:
>> b) AND the data also contained, for the first time, non-ascii
>> characters that make grep fail unless the -a option is used
>>
>> I am not sure at all of what I have just written, and every comment,
>> and tip to make sure this does not happen again in some future script
>> is very welcome.
>
> Hi,
>
> even 'grep -a' could return undesired output. A way to workaround this
> issue might be using the 'strings' command and than piping through
> 'grep'.
>
> [rocketmouse at archlinux ~]$ grep -a SOURCE
> /var/log/journal/a243f4e05c294b13ab6972bf4ff93907/system.journal |
> tail -1
> _SOURCE_REALTIME_TIMESTAMP=1539795805565362��R��q�ox!�b���_��I���t'���v�|����8�&�������8���G��H�8�Qk��|���?
> [rocketmouse at archlinux ~]$ strings
> /var/log/journal/a243f4e05c294b13ab6972bf4ff93907/system.journal |
> grep SOURCE | tail -1
> _SOURCE_REALTIME_TIMESTAMP=1539795805565362
> [rocketmouse at archlinux ~]$
>
> Regards,
> Ralf
More information about the ubuntu-users
mailing list