Re: File re-format
On 2006-08-17, bsh wrote:
>
> Chris F.A. Johnson wrote:
>> bsh wrote:
>> > Chris F.A. Johnson wrote:
>> > > bsh wrote:
>> > > > yuriy_zubarev wrote:
>
>> $ dd if=txt bs=50 conv=block,noerror,sync | od -c
>> 0000020 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
>
> Hmmm... What I read in the dd(1) manpage before posting was:
>
> sync
> Pad every input block with NULs to ibs-size; when
> used with block or unblock, pad with spaces rather than NULs.
It also removes the newlines:
$ dd if=~/txt cbs=50 bs=50 conv=block | hd
0+1 records in
7+0 records out
0: 61 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 a
16: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
32: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
48: 20 20 62 20 20 20 20 20 20 20 20 20 20 20 20 20 b
64: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
96: 20 20 20 20 63 20 20 20 20 20 20 20 20 20 20 20 c
112: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
128: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
144: 20 20 20 20 20 20 64 20 20 20 20 20 20 20 20 20 d
160: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
176: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
192: 20 20 20 20 20 20 20 20 65 20 20 20 20 20 20 20 e
208: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
224: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
240: 20 20 20 20 20 20 20 20 20 20 66 20 20 20 20 20 f
256: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
272: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
288: 20 20 20 20 20 20 20 20 20 20 20 20 67 20 20 20 g
304: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
320: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
336: 20 20 20 20 20 20 20 20 20 20 20 20 20 20
> Maybe a variant or GNU extension?
Possibly.
> Once upon a time, using dd(1) extensively with SVR3/4, I distinctly
> remember dd(1) performing the expected behavior.
And there was no block conversion in SVR3.2 (for which I have a
manual).
--
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
|