Re: oflag option in GNU dd - equivalent in FreeBSD dd ?

2007-10-23 Thread Bahman M.
On 2007-10-22 Juri Mianovich wrote:
 I am used to using this command in Linux, using GNU
 dd:
 
 dd if=/blah of=/bleh oflag=append conv=notrunc
 
 The problem is, FreeBSD 'dd' does not understand the
 oflag argument.
 
 Is there some equivalent in the FreeBSD 'dd' syntax
 that I can use, or am I forced to install GNU utils ?
 
dd if=/blah of=/bleh conv=notrunc seek=`ls -s /bleh | cut -f1 -d ' ' -`

I don't know if any simpler way is possible (anyone?).

Bahman
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: oflag option in GNU dd - equivalent in FreeBSD dd ?

2007-10-23 Thread Oliver Fromme
Bahman M. [EMAIL PROTECTED] wrote:
  On 2007-10-22 Juri Mianovich wrote:
   I am used to using this command in Linux, using GNU
   dd:
   
   dd if=/blah of=/bleh oflag=append conv=notrunc
   
   The problem is, FreeBSD 'dd' does not understand the
   oflag argument.
   
   Is there some equivalent in the FreeBSD 'dd' syntax
   that I can use, or am I forced to install GNU utils ?

Of course, the easiest way is to do this:

$ dd if=/blah  /bleh

If you cannot do that, please explain why.  If you know
your reason, there might be an alternative way to do it.

  dd if=/blah of=/bleh conv=notrunc seek=`ls -s /bleh | cut -f1 -d ' ' -`
  
  I don't know if any simpler way is possible (anyone?).

$ dd if=/blah of=/bleh conv=notrunc seek=$(stat -f%z /bleh)

I suggest to write a small alias or shell function if
you need to use such commands often.  The following
shell function (for sh, zsh or bash) will do:

ddappend()
{
dd if=$1 of=$2 conv=notrunc seek=$(stat -f%z -- $2)
}

Then you can simply write:  $ ddappend /blah /bleh

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH  Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

Passwords are like underwear.  You don't share them,
you don't hang them on your monitor or under your keyboard,
you don't email them, or put them on a web site,
and you must change them very often.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: oflag option in GNU dd - equivalent in FreeBSD dd ?

2007-10-23 Thread RW
On Tue, 23 Oct 2007 16:42:46 +0330
Bahman M. [EMAIL PROTECTED] wrote:

 On 2007-10-22 Juri Mianovich wrote:
  I am used to using this command in Linux, using GNU
  dd:
  
  dd if=/blah of=/bleh oflag=append conv=notrunc
  
  The problem is, FreeBSD 'dd' does not understand the
  oflag argument.
  
  Is there some equivalent in the FreeBSD 'dd' syntax
  that I can use, or am I forced to install GNU utils ?
  
 dd if=/blah of=/bleh conv=notrunc seek=`ls -s /bleh | cut -f1 -d ' '
 -`
 
 I don't know if any simpler way is possible (anyone?).
 

is it any different to 

dd if=/blah  /bleh 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: oflag option in GNU dd - equivalent in FreeBSD dd ?

2007-10-23 Thread Dan Nelson
In the last episode (Oct 23), Oliver Fromme said:
 Bahman M. [EMAIL PROTECTED] wrote:
   On 2007-10-22 Juri Mianovich wrote:
I am used to using this command in Linux, using GNU
dd:

dd if=/blah of=/bleh oflag=append conv=notrunc

The problem is, FreeBSD 'dd' does not understand the
oflag argument.

Is there some equivalent in the FreeBSD 'dd' syntax
that I can use, or am I forced to install GNU utils ?
 
 Of course, the easiest way is to do this:
 
 $ dd if=/blah  /bleh
 
 If you cannot do that, please explain why.  If you know
 your reason, there might be an alternative way to do it.
 
   dd if=/blah of=/bleh conv=notrunc seek=`ls -s /bleh | cut -f1 -d ' ' -`
   
   I don't know if any simpler way is possible (anyone?).
 
 $ dd if=/blah of=/bleh conv=notrunc seek=$(stat -f%z /bleh)

I don't think that will work, since seek's argument is in blocks.  Even
if you divide by 512 (or whatever you decide to set bs=), if the file
you're appending do isn't a multiple of the blocksize, you'll end up
chopping part of the end off.

-- 
Dan Nelson
[EMAIL PROTECTED]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: oflag option in GNU dd - equivalent in FreeBSD dd ?

2007-10-23 Thread Bahman M.
On 2007-10-23 Dan Nelson wrote:
 In the last episode (Oct 23), Oliver Fromme said:
  Bahman M. [EMAIL PROTECTED] wrote:
On 2007-10-22 Juri Mianovich wrote:
 I am used to using this command in Linux, using GNU
 dd:
 
 dd if=/blah of=/bleh oflag=append conv=notrunc
 
 The problem is, FreeBSD 'dd' does not understand the
 oflag argument.
 
 Is there some equivalent in the FreeBSD 'dd' syntax
 that I can use, or am I forced to install GNU utils ?
  
  Of course, the easiest way is to do this:
  
  $ dd if=/blah  /bleh
  
  If you cannot do that, please explain why.  If you know
  your reason, there might be an alternative way to do it.
  
dd if=/blah of=/bleh conv=notrunc seek=`ls -s /bleh | cut -f1 -d
' ' -`

I don't know if any simpler way is possible (anyone?).
  
  $ dd if=/blah of=/bleh conv=notrunc seek=$(stat -f%z /bleh)
 
 I don't think that will work, since seek's argument is in blocks.
 Even if you divide by 512 (or whatever you decide to set bs=), if the
 file you're appending do isn't a multiple of the blocksize, you'll
 end up chopping part of the end off.
 
Good point!  The following should cover that:
sh$ dd if=/blah of=/bleh conv=notrunc bs=1 seek=$(stat -f%z /bleh)
or
tcsh% dd if=/blah of=/bleh conv=notrunc bs=1 seek=`stat -f%z /bleh`

I wonder if bs=1 can cause any slow down when working with large files?

Bahman
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: oflag option in GNU dd - equivalent in FreeBSD dd ?

2007-10-23 Thread Oliver Fromme
Dan Nelson wrote:
  Oliver Fromme wrote:
   Of course, the easiest way is to do this:
   
   $ dd if=/blah  /bleh

I still think the OP should prefer that solution.

   If you cannot do that, please explain why.  If you know
   your reason, there might be an alternative way to do it.
   
dd if=/blah of=/bleh conv=notrunc seek=`ls -s /bleh | cut -f1 -d ' ' -`

I don't know if any simpler way is possible (anyone?).
   
   $ dd if=/blah of=/bleh conv=notrunc seek=$(stat -f%z /bleh)
  
  I don't think that will work, since seek's argument is in blocks.

Oops, you're right.  I forgot about that.

  Even
  if you divide by 512 (or whatever you decide to set bs=), if the file
  you're appending do isn't a multiple of the blocksize, you'll end up
  chopping part of the end off.

I wonder how GNU dd's append oflag behaves in that case.
It would also either have to chop some bytes off the end,
or leave a gap of zeros.  Either way could be emulated.

$ dd if=/blah of=/bleh conv=notrunc seek=$(( $(stat -f%z /bleh) / 512 ))

That one would chop some bytes of the end if the file size
isn't a multiple of 512 (the default block size).  To leave
a gap in that case, use this formula:

$ ... seek=$(( ($(stat -f%z /bleh) + 511) / 512 ))

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH  Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

Emacs ist für mich kein Editor. Für mich ist das genau das gleiche, als
wenn ich nach einem Fahrrad (für die Sonntagbrötchen) frage und einen
pangalaktischen Raumkreuzer mit 10 km Gesamtlänge bekomme. Ich weiß nicht,
was ich damit soll. -- Frank Klemm, de.comp.os.unix.discussion
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: oflag option in GNU dd - equivalent in FreeBSD dd ?

2007-10-23 Thread Bahman M.
On 2007-10-23 RW wrote:
 On Tue, 23 Oct 2007 16:42:46 +0330
 Bahman M. [EMAIL PROTECTED] wrote:
 
  On 2007-10-22 Juri Mianovich wrote:
   I am used to using this command in Linux, using GNU
   dd:
   
   dd if=/blah of=/bleh oflag=append conv=notrunc
   
   The problem is, FreeBSD 'dd' does not understand the
   oflag argument.
   
   Is there some equivalent in the FreeBSD 'dd' syntax
   that I can use, or am I forced to install GNU utils ?
   
  dd if=/blah of=/bleh conv=notrunc seek=`ls -s /bleh | cut -f1 -d ' '
  -`
  
  I don't know if any simpler way is possible (anyone?).
  
 
 is it any different to 
 
 dd if=/blah  /bleh 

Not at all.  But as OP is trying to avoid 'cat /blah  /bleh' I
assumed that he also wouldn't want the shell to append the data
to /bleh; I may be wrong though.

Bahman
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


oflag option in GNU dd - equivalent in FreeBSD dd ?

2007-10-22 Thread Juri Mianovich
I am used to using this command in Linux, using GNU
dd:

dd if=/blah of=/bleh oflag=append conv=notrunc

The problem is, FreeBSD 'dd' does not understand the
oflag argument.

Is there some equivalent in the FreeBSD 'dd' syntax
that I can use, or am I forced to install GNU utils ?



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: oflag option in GNU dd - equivalent in FreeBSD dd ?

2007-10-22 Thread Dan Nelson
In the last episode (Oct 22), Juri Mianovich said:
 I am used to using this command in Linux, using GNU
 dd:
 
 dd if=/blah of=/bleh oflag=append conv=notrunc
 
 The problem is, FreeBSD 'dd' does not understand the
 oflag argument.
 
 Is there some equivalent in the FreeBSD 'dd' syntax
 that I can use, or am I forced to install GNU utils ?

Why not cat /blah  /bleh ?  dd is usually used on raw device nodes,
and appending doesn't make sense there.

-- 
Dan Nelson
[EMAIL PROTECTED]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: oflag option in GNU dd - equivalent in FreeBSD dd ?

2007-10-22 Thread Juri Mianovich

--- Dan Nelson [EMAIL PROTECTED] wrote:

 In the last episode (Oct 22), Juri Mianovich said:
  I am used to using this command in Linux, using
 GNU
  dd:
  
  dd if=/blah of=/bleh oflag=append conv=notrunc
  
  The problem is, FreeBSD 'dd' does not understand
 the
  oflag argument.
  
  Is there some equivalent in the FreeBSD 'dd'
 syntax
  that I can use, or am I forced to install GNU
 utils ?
 
 Why not cat /blah  /bleh ?  dd is usually used
 on raw device nodes,
 and appending doesn't make sense there.


I have a long, boring (but good) reason that I can't
use 'cat'.  I need to use 'dd'.

The syntax above will work perfectly if I use GNU dd,
but I'd like to simplify the setup and use the
built-in n'dd' if possible.

So ... is there a freebsd equivalent to the GNU:

dd if=/blah of=/bleh oflag=append conv=notrunc

syntax ?  Anyone ?

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]