Preklopeni binarniho souboru do TXT
Jindroush
jindroush na seznam.cz
Pátek Leden 27 10:51:24 CET 2017
Pravda. Vtip je v tom, ze ten soubor se nacte po 'radkach', nikoli jako
jeden binarni blob, takze pak se to reverse dela v ramci radku...
Nevim, jak to v tom onelineru fixnout.
J.
On 27.1.2017 10:08, Tom Meinlschmidt wrote:
> zkuste sam..
>
> dd if=/dev/random of=file.txt bs=1024 count=64
> cat file.txt | perl -ne "print join(',',reverse(unpack('C*',$_)));"
>
> a ted pro porovnani
> hexdump file.txt | head -1
>
> ja dostanu z perlu:
> ...,246,84,216,25,165,38,166,71,37,97,194,240,197,50,33,213,201,79,242,13,74,191,255,208,145(EOF)
>
>
> a z hexdumpu
> 0000000 8c 58 a8 b2 55 dd c6 02 7b 59 79 ea 01 ba 98 9d
>
> resp
> hexdump -v -e '16/1 "%03u " "\n"' file.txt |head -1
> 140 088 168 178 085 221 198 002 123 089 121 234 001 186 152 157
>
> coz proste nesedi s tim perlem. Perl by mel koncit na 088 140...
>
> tm
>
> On 2017-01-27 08:30, Jindroush wrote:
>> Proc, co je v nem blbe? Proste vezme vstup a vypise ho jako dec cisla
>> oddelena carkou, tak jsem pochopil zadani, na linuxu by nemelo vadit
>> nejaky hrani s binary a tak...
>>
>> On 27.1.2017 0:23, Tom Meinlschmidt wrote:
>>> chyba.
>>>
>>> ma byt hexdump -v -e '/1 "%03d" " “‘ … a "od -An -tuC"
>>>
>>> jinak to bylo v osmickove..
>>>
>>> btw - ten perl taky nefunguje spravne...
>>>
>>> tm
>>>
>>>> On Jan 27, 2017, at 0:02 , Tom Meinlschmidt <hw at meinlschmidt.org>
>>>> wrote:
>>>>
>>>> test - 64kB soubor (data z /dev/random)
>>>>
>>>> cat file.txt | hexdump -v -e '/1 "%03o" "\n"' | tac | xargs -n8 | tr
>>>> ' ' ','
>>>>
>>>> real 0m26.837s
>>>> user 0m7.769s
>>>> sys 0m11.485s
>>>>
>>>> bez zarovnavani na 8 sloupcu
>>>>
>>>> cat file.txt | hexdump -v -e '/1 "%03o" " "' | tac -s’ ‘ | tr ‘ ‘ ‘,'
>>>>
>>>> real 0m0.333s
>>>> user 0m0.048s
>>>> sys 0m0.022s
>>>>
>>>> nebo
>>>>
>>>> cat file.txt | od -An -b | cut -c 2- | tr ' ' '\n' | tac | xargs -n8
>>>> | tr ' ' ','
>>>>
>>>> real 0m28.978s
>>>> user 0m8.125s
>>>> sys 0m12.093s
>>>>
>>>> nebo
>>>>
>>>> cat file.txt | od -An -b | cut -c 2- | tr '\n' ' ' | tac -s ' ' | tr
>>>> ' ' ‘,'
>>>>
>>>> real 0m0.404s
>>>> user 0m0.051s
>>>> sys 0m0.028s
>>>>
>>>> tm
>>>>
>>>>> On Jan 26, 2017, at 22:05 , Admin HWnews <hwnews at cncnet.info> wrote:
>>>>>
>>>>> Hmm prisel jsem na dalsi spek....
>>>>>
>>>>> Ja bych ten soubor potreboval jeste prevratit...tedy aby posledni
>>>>> bajt byl prvni. Nejakej napad?
>>>>>
>>>>> Prece to nebudu prohanet pres tabulku v DB...
>>>>>
>>>>> RV
>>>>>
>>>>>
>>>>> Dne 24.1.2017 v 17:51 Tom Meinlschmidt napsal(a):
>>>>>> odvolavam, co jsem neslibil. mate pravdu - potrebuje to -v
>>>>>> tm
>>>>>>
>>>>>>> On Jan 24, 2017, at 17:37 , Tom Meinlschmidt
>>>>>>> <hw at meinlschmidt.org> wrote:
>>>>>>>
>>>>>>>
>>>>>>> ? bash?
>>>>>>>
>>>>>>> $ printf 'e\0\0\0cho a\0\0b\n' | hexdump -v -e '/1 "%03o" "\n"' |
>>>>>>> xargs -n8 | tr ' ' ','
>>>>>>> 145,000,000,000,143,150,157,040
>>>>>>> 141,000,000,142,012
>>>>>>>
>>>>>>> tm
>>>>>>>
>>>>>>> On 2017-01-24 17:24, Petr Simek wrote:
>>>>>>>> On Tue, 24 Jan 2017, Tom Meinlschmidt wrote:
>>>>>>>>> co treba
>>>>>>>>> hexdump -e '/1 "%03o" "\n"' /bin/bash | xargs -n8 | tr ' ' ','
>>>>>>>> Kdyz jsou v souboru dve nuly za sebou tak to prvni vypise jako
>>>>>>>> 060 a
>>>>>>>> tu druhou jako * .
>>>>>>>>> tm
>>>>>>>> *------------------------------------------------------------------------*
>>>>>>>>
>>>>>>>> | Petr Simek APS
>>>>>>>> JU |
>>>>>>>> |
>>>>>>>> psimek at jcu.cz |
>>>>>>>> *------------------------------------------------------------------------*
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> HW-list mailing list - sponsored by www.HW.cz
>>>>>>>> Hw-list at list.hw.cz
>>>>>>>> http://list.hw.cz/mailman/listinfo/hw-list
>>>>>>> _______________________________________________
>>>>>>> HW-list mailing list - sponsored by www.HW.cz
>>>>>>> Hw-list at list.hw.cz
>>>>>>> http://list.hw.cz/mailman/listinfo/hw-list
>>>>>>
>>>>> _______________________________________________
>>>>> HW-list mailing list - sponsored by www.HW.cz
>>>>> Hw-list at list.hw.cz
>>>>> http://list.hw.cz/mailman/listinfo/hw-list
>>>>
>>>> --
>>>> ===============================================================================
>>>>
>>>> Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
>>>>
>>>> www.meinlschmidt.com www.maxwellrender.cz
>>>> ===============================================================================
>>>>
>>>>
>>>> _______________________________________________
>>>> HW-list mailing list - sponsored by www.HW.cz
>>>> Hw-list at list.hw.cz
>>>> http://list.hw.cz/mailman/listinfo/hw-list
>>>
> _______________________________________________
> HW-list mailing list - sponsored by www.HW.cz
> Hw-list at list.hw.cz
> http://list.hw.cz/mailman/listinfo/hw-list
--
Jindroush <jindroush at seznam.cz>
Další informace o konferenci Hw-list