I have a file that contains a long list of integers written in ascii separated with newlines, like such:
-175
2
-19345
345592
-45
2355
etc…
I want to convert this file into a "binary" file containing the same integers, written as actual 4 byte integers.
What command-line tool can I use to achieve this?
Best Answer
Uses the local endianness. Use
l>
instead ofl
for big-endian, andl<
for little-endian.See
perldoc -f pack
for more info.Note that it's
l
as in lowercaseL
(for long integer), not the1
digit.