[clug] 'dd' command detecting EOF: an example script
Peter Barker
pbarker at barker.dropbear.id.au
Wed May 15 08:02:51 UTC 2019
On Wed, 15 May 2019, Steve Jenkin wrote:
> Peter,
> thanks very much for that - hadn’t caught up with GNU split ‘chunking’ to a command.
>
> Doesn’t write to STDOUT, so extra work needed to insert into a pipeline.
You know, that's the way I initially read it too. Turns out $FILE is the
*output* filename!
But check out "split" here:
https://www.gnu.org/software/coreutils/manual/html_node/split-invocation.html
================
‘--filter=command’
With this option, rather than simply writing to each output file,
write through a pipe to the specified shell command for each output file.
command should use the $FILE environment variable, which is set to a
different output file name for each invocation of the command. For
example, imagine that you have a 1TiB compressed file that, if
uncompressed, would be too large to reside on disk, yet you must split it
into individually-compressed pieces of a more manageable size. To do that,
you might run this command:
xz -dc BIG.xz | split -b200G --filter='xz > $FILE.xz' - big-
=================
> steve
Yours,
--
Peter Barker | Programmer,Sysadmin,Geek.
pbarker at barker.dropbear.id.au | You need a bigger hammer.
:: in what circumstances would you want reverse thrust for takeoff? --tridge
More information about the linux
mailing list