[Gllug] Splitting files at 2GB barrier

Nix nix at esperi.org.uk
Sat Jan 27 20:27:02 UTC 2007


On 26 Jan 2007, Tethys uttered the following:
> Nix writes:
>>for i in $(seq 1 9); do
>>    gzip --best | dd of=<mounted smb share>/image.part${i}.gz obs=1000000 coun
>>t=2000
>>done < (cat /dev/hda)
>>
>>(note the brackets! That runs the cat in a coprocess and feeds the
>>output in on stdin.)
>
> Being picky (because that's just what I do!), you mean parentheses,
> not brackets :-)

Parentheses *are* brackets, they're just more specific (and it is true
that in this case the code wouldn't work if, say, square brackets were
used).

>                  You also qualify for a gratuitous use of cat award...

Nope, not in that case; plain redirection into loops doesn't work with
many shells (even some which support coprocesses).

>>> cat seemed to be essential... I know it's not good form.
>>
>>It sometimes makes things clearer.
>
> Perhaps in a few rare cases, yes. But this isn't one of them. I fail
> to see how:
>
> 	some command <(cat /dev/hda)
>
> is an improvement on:
>
> 	some_command < /dev/hda

The former works if you've got a loop. The latter often doesn't.

-- 
`The serial comma, however, is correct and proper, and abandoning it will
surely lead to chaos, anarchy, rioting in the streets, the Terrorists
taking over, and possibly the complete collapse of Human Civilization.'
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list