<div dir="ltr">ja tam mam nejaky problem - nesedi mi hexa na dekadicky viz priloha z realneho souboru</div><div class="gmail_extra"><br><div class="gmail_quote">Dne 24. ledna 2017 14:08 Václav Ovsík <span dir="ltr"><<a href="mailto:vaclav.ovsik@gmail.com" target="_blank">vaclav.ovsik@gmail.com</a>></span> napsal(a):<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Jan 24, 2017 at 01:55:42PM +0100, Václav Ovsík wrote:<br>
> On Tue, Jan 24, 2017 at 01:23:42PM +0100, Jan Waclawek wrote:<br>
> > > dd if=/bin/sh bs=1 |od -Anone -tu1 -v | sed -r 's/^[[:space:]]+//; s/[[:space:]]+/,/g;'<br>
> ><br>
> > Vam nieco padlo na klavesnicu, pan kolega? ;-)<br>
> ><br>
> > Ale obdivujem Vas. Toto prevadzkovat v realnom zivote je snad este tazsie<br>
> > ako programovat v BF... :-D<br>
><br>
> tak jo, byla to trochu provokace, kdyz sla rec o te lenosti ;)<br>
><br>
> Uz spis administruju nez programuju. Letmo jsem zkusil z cvicnych duvodu<br>
> vzpomenout jako by se to napsalo v C<br>
><br>
> #include <stdio.h><br>
><br>
> int main() {<br>
> unsigned c;<br>
> unsigned i = 0;<br>
> while ( (c = getchar()) != EOF ) {<br>
> printf("%d", c);<br>
> putchar((++i & 0xF) == 0 ? '\n' : ',');<br>
> }<br>
> return 0;<br>
> }<br>
<br>
</span>Anebo asi takto:<br>
<span class=""><br>
#include <stdio.h><br>
<br>
int main() {<br>
unsigned c;<br>
unsigned i = 0;<br>
</span> char sep = 0;<br>
<span class=""> while ( (c = getchar()) != EOF ) {<br>
</span> if ( sep )<br>
putchar(sep);<br>
printf("%d", c);<br>
sep = (++i & 0xF) == 0 ? '\n' : ',';<br>
}<br>
putchar('\n');<br>
return 0;<br>
}<br>
<br>
To vypada, ze uz funguje ve shode s tim shell onelinerem.<br>
<br>
zito@bobek:~$ echo Ahoj |od -Anone -tu1 -v | sed -r 's/^[[:space:]]+//; s/[[:space:]]+/,/g;'<br>
65,104,111,106,10<br>
zito@bobek:~$ echo Ahoj | /tmp/decdump<br>
65,104,111,106,10<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
--<br>
Zito<br>
______________________________<wbr>_________________<br>
HW-list mailing list - sponsored by <a href="http://www.HW.cz" rel="noreferrer" target="_blank">www.HW.cz</a><br>
<a href="mailto:Hw-list@list.hw.cz">Hw-list@list.hw.cz</a><br>
<a href="http://list.hw.cz/mailman/listinfo/hw-list" rel="noreferrer" target="_blank">http://list.hw.cz/mailman/<wbr>listinfo/hw-list</a><br>
</div></div></blockquote></div><br></div>