9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Tharaneedharan Vilwanathan <vdharani@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] Binary File split
Date: Mon, 10 May 2010 01:28:48 -0700	[thread overview]
Message-ID: <u2sdac0a5821005100128u3c190a6ax299a7cd8d2af9c8f@mail.gmail.com> (raw)
In-Reply-To: <g2ndf49a7371005100057u3e4788d7m1bc8c7ed40561f85@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1346 bytes --]

hi,

since i see many solutions, i thought i will add mine too (if you can
use inferno). attached please see the limbo program i wrote for this.
it has helped me many times: didnt have to come out with parameters
for dd commands which i used to use before for this kind of tasks.

please note that the program is very crude. i am sending it as is.

thanks
dharani

On Mon, May 10, 2010 at 12:57 AM, roger peppe <rogpeppe@gmail.com> wrote:
> On 8 May 2010 18:35, Russ Cox <rsc@swtch.com> wrote:
>> bs=1474560
>> cat $file | for(i in `{seq 0 `{ls -l $file | awk '{print
>> int($6)/'$bs'}'}}) { dd -bs $bs -count 1 -of $file.$i }
>
> that looks very plausible, but it doesn't actually work,
> as awk doesn't coelesce short reads (it gets short
> reads from the pipe)
>
> this works a little better:
>
> bs=1474560
> {for(i in `{seq 0 `{ls -l $file | awk '{print
> int($6)/'$bs'}'}}) { dd -bs $bs -count 1 -of $file.$i -quiet 1 }} < $file
>
> but there's still a little annoyance - if the file size is an exact
> multiple of the block size, it will generate an unnecessary zero-length
> file at the end.
>
> i tried to fix it to get rid of this, but ran hard up against awk's
> dismalness. to illustrate:
>
> % seq 106908504 106908509 | awk '{print $1 % 4}'
> 0
> 0
> 0
> 0
> 0
> 0
> %
>
> oh dear.
>
>

[-- Attachment #2: splitcp.b --]
[-- Type: chemical/x-molconn-z, Size: 1448 bytes --]

  parent reply	other threads:[~2010-05-10  8:28 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-04 10:58 [9fans] BibTex collections of all 4 proceedings EBo
2010-05-04 19:59 ` [9fans] iwp9.org (Re: BibTex collections of all 4 proceedings) Jonas Amoson
2010-05-06 14:55   ` erik quanstrom
2010-05-06 15:12     ` Jeff Sickel
2010-05-06 16:00       ` ron minnich
2010-05-06 16:01         ` erik quanstrom
2010-05-06 16:18           ` ron minnich
2010-05-06 17:13             ` tlaronde
2010-05-06 19:52               ` EBo
2010-05-06 17:45             ` Wes Kussmaul
2010-05-06 18:12               ` Skip Tavakkolian
2010-05-06 18:35                 ` ron minnich
2010-05-06 19:46                   ` Skip Tavakkolian
2010-05-06 20:36                     ` ron minnich
2010-05-06 21:21                       ` Skip Tavakkolian
2010-05-06 21:45                         ` ron minnich
2010-05-06 21:55                           ` Skip Tavakkolian
2010-05-06 23:03                           ` erik quanstrom
2010-05-06 23:08                             ` ron minnich
2010-05-06 23:13                               ` erik quanstrom
2010-05-07  0:16                               ` Christopher Nielsen
2010-05-07  0:35                               ` balaji
2010-05-07  0:47                             ` Skip Tavakkolian
2010-05-07 13:09                           ` Eric Van Hensbergen
2010-05-07 13:59                             ` Paul Lalonde
2010-05-07 14:48                             ` ron minnich
2010-05-07 15:37                               ` Ramon de Vera
2010-05-07 15:47                                 ` David Leimbach
2010-05-07 23:11                                   ` Mathieu Lonjaret
2010-05-08  0:04                                     ` ron minnich
2010-05-08 11:34                                     ` tlaronde
2010-05-08 16:48                                       ` erik quanstrom
2010-05-08 17:33                                         ` tlaronde
2010-05-08 17:45                                           ` ron minnich
2010-05-08 21:34                                             ` David Leimbach
2010-05-12 16:08                                               ` Chad Brown
2010-05-12 16:26                                                 ` Rodolfo (kix)
2010-05-12 17:06                                                   ` ron minnich
2010-05-13 18:16                                                 ` EBo
2010-05-13 23:26                                                   ` Chad Brown
2010-05-13 23:40                                                     ` ron minnich
2010-05-14  2:45                                                       ` EBo
2010-05-14  3:14                                                         ` ron minnich
2010-05-14  3:18                                                           ` EBo
2010-05-14  3:27                                                           ` erik quanstrom
2010-05-14  3:41                                                             ` ron minnich
2010-05-14  2:24                                                   ` Jeff Sickel
2010-05-14  3:14                                                     ` ron minnich
2010-05-15  1:53                                                       ` Jeff Sickel
2010-05-15  1:59                                                         ` ron minnich
2010-05-15  2:04                                                           ` Jeff Sickel
2010-05-15  2:27                                                         ` EBo
2010-05-15  3:22                                                           ` ron minnich
2010-05-15  3:58                                                             ` EBo
2010-05-15 15:45                                                               ` Kim Shrier
2010-05-15 16:12                                                                 ` EBo
2010-05-15 16:31                                                                   ` Kim Shrier
2010-05-15 19:46                                                                     ` ron minnich
2010-05-15 21:52                                                                       ` EBo
2010-05-08  3:40                             ` [9fans] Binary File split Yard Ape
2010-05-08  4:41                               ` erik quanstrom
2010-05-08  5:39                               ` Skip Tavakkolian
2010-05-08 17:35                                 ` Russ Cox
2010-05-10  7:57                                   ` roger peppe
2010-05-10  8:26                                     ` Arvindh Rajesh Tamilmani
2010-05-10  8:28                                     ` Tharaneedharan Vilwanathan [this message]
2010-05-10 11:40                                     ` erik quanstrom
2010-05-10 12:17                                       ` roger peppe
2010-05-10 14:01                                         ` gas
2010-05-10 14:52                                           ` Iruata Souza
2010-05-10 15:17                                             ` Ethan Grammatikidis
2010-05-10 15:39                                               ` erik quanstrom
2010-05-10 16:01                                                 ` Ethan Grammatikidis
2010-05-11  1:39                                               ` Derek Thomas
2010-05-10 17:26                                         ` Skip Tavakkolian
2010-05-06 21:55                         ` [9fans] iwp9.org (Re: BibTex collections of all 4 proceedings) EBo
2010-05-07  3:36                   ` John Floren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=u2sdac0a5821005100128u3c190a6ax299a7cd8d2af9c8f@mail.gmail.com \
    --to=vdharani@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).