💾 Archived View for heavysquare.com › unix › 9975-intersperse-chars-with-dd.txt captured on 2022-04-29 at 11:25:53.

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

# Block files are used on some systems, concept is that lines are fixed
# length and padded with spaces if needed. But if all lines are same
# lenght and that length is part of the file metadata, you do not even
# need newlines.


$ echo mountains
mountains
$ echo mountains | dd conv=unblock,ucase cbs=1 status=none
M
O
U
N
T
A
I
N
S


$ echo mountains | dd conv=unblock,ucase cbs=1 status=none | grep . | dd conv=block cbs=2 status=none
M O U N T A I N S %
$ echo mountains | dd conv=unblock,ucase cbs=1 status=none | grep . | dd conv=block cbs=2 status=none | tr ' ' '^' | rev | cut -c2- | rev
M^O^U^N^T^A^I^N^S
$ echo mountains | dd conv=unblock,ucase cbs=1 status=none | grep . | dd conv=block cbs=3 status=none | tr ' ' '^' | rev | cut -c3- | rev
M^^O^^U^^N^^T^^A^^I^^N^^S
$