Expertise Required With dd command
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Expertise Required With dd command




Pages (2): [1] 2 »   Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Expertise Required With dd command  
pankaj_wolfhunter@yahoo.co.in


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-25-05 10:53 PM

hi,
I want to extract some bytes of data from file1 to file2. I am
using dd command to specify the bytes and output file name. but it does
not perform as required. Here is my command:

dd count=1 bs=1046459 if=file1.txt of=file2.txt

I have specified the bytes required but the command takes some couple
of bytes extra.

I have tried everything but this behaviour repeats again & again. Can
anyone help me on this?

TIA






[ Post a follow-up to this message ]



    Re: Expertise Required With dd command  
Jordon Hofer


Report This Message To A Moderator Edit/Delete Message


 
10-25-05 10:53 PM

if you are pulling text from the beginning, maybe the head command would
work for you. maybe try something like

head -c 1046459 file1.txt > file2.txt

jorj

<pankaj_wolfhunter@yahoo.co.in> wrote in message
news:1130251250.836988.235430@g49g2000cwa.googlegroups.com...
> hi,
>       I want to extract some bytes of data from file1 to file2. I am
> using dd command to specify the bytes and output file name. but it does
> not perform as required. Here is my command:
>
> dd count=1 bs=1046459 if=file1.txt of=file2.txt
>
> I have specified the bytes required but the command takes some couple
> of bytes extra.
>
> I have tried everything but this behaviour repeats again & again. Can
> anyone help me on this?
>
> TIA
>







[ Post a follow-up to this message ]



    Re: Expertise Required With dd command  
pankaj_wolfhunter@yahoo.co.in


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-26-05 07:49 AM

Jordon, thnx for the reply. Actually we want to extract data from that
file with different byte positions. This was just an example. So in
first case we may extract data from the start of the file and output
the result in one file and then in second case from the middle of the
file to some other output file and so on.
Is there any way the dd file can give us exact result? Is there any
other alternative to dd?

TIA






[ Post a follow-up to this message ]



    Re: Expertise Required With dd command  
Luotao Fu


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-26-05 12:54 PM

pankaj_wolfhunter@yahoo.co.in schrieb:
> hi,
>        I want to extract some bytes of data from file1 to file2. I am
> using dd command to specify the bytes and output file name. but it does
> not perform as required. Here is my command:
>
> dd count=1 bs=1046459 if=file1.txt of=file2.txt
>
> I have specified the bytes required but the command takes some couple
> of bytes extra.
>
> I have tried everything but this behaviour repeats again & again. Can
> anyone help me on this?
>
> TIA
>

user@odysseus:~$ dd count=1 bs=1046459 if=/dev/zero of=test.out
1+0 Datensätze ein
1+0 Datensätze aus
1046459 bytes transferred in 0,011986 seconds (87306558 bytes/sec)
user@odysseus:~$ ls -al test.out
-rw-r--r--  1 user user 1046459 2005-10-26 13:01 test.out


?????

works for me. You have to describe your problem more precisely.

Cheers
Luotao Fu





[ Post a follow-up to this message ]



    Re: Expertise Required With dd command  
pankaj_wolfhunter@yahoo.co.in


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-26-05 12:54 PM

thanx for the reply again.
here is what happening.

i have a file(clob.txt) of size 4992680. i use the following command

dd count=1 bs=1047142 if=clob.txt of=out.txt
1+0 records in
1+0 records out

now i do ls -al out.txt
-rw-r--r--   1 miguser  mig      1047142 Oct 26 16:43 out.txt

When i open this file using some editor like EditPlus, it and when i do
select all, the number of bytes shown are 1098101.

In unix command shell it shows the size as 1047142 and when i open and
check the file size its 1098101. Here i am getting some bytes extra.

I am unable to figure out whats the problem?

Thanx






[ Post a follow-up to this message ]



    Re: Expertise Required With dd command  
moi


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-26-05 12:54 PM

pankaj_wolfhunter@yahoo.co.in wrote:
> Jordon, thnx for the reply. Actually we want to extract data from that
> file with different byte positions. This was just an example. So in
> first case we may extract data from the start of the file and output
> the result in one file and then in second case from the middle of the
> file to some other output file and so on.
> Is there any way the dd file can give us exact result? Is there any
> other alternative to dd?
>
> TIA
>

You don't need the bs=xxx option.
Check count=xxx && skip=yyy

It's all in TFM ...

HTH,
AvK





[ Post a follow-up to this message ]



    Re: Expertise Required With dd command  
Luotao Fu


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-26-05 12:54 PM

pankaj_wolfhunter@yahoo.co.in schrieb:
> thanx for the reply again.
> here is what happening.
>
> i have a file(clob.txt) of size 4992680. i use the following command
>
> dd count=1 bs=1047142 if=clob.txt of=out.txt
> 1+0 records in
> 1+0 records out
>
> now i do ls -al out.txt
> -rw-r--r--   1 miguser  mig      1047142 Oct 26 16:43 out.txt
>
> When i open this file using some editor like EditPlus, it and when i do
> select all, the number of bytes shown are 1098101.
>
> In unix command shell it shows the size as 1047142 and when i open and
> check the file size its 1098101. Here i am getting some bytes extra.
>
> I am unable to figure out whats the problem?
>
> Thanx
>

This is not a problem of dd. It's a problem of your editor.
1. It's a reeeeeeally bad idea to count the exact size of a text file
with an Editor. There're a lot of symbols, which may be counted wrong.
(tabs, newline etc.). You should trust what your filesystem tells you.
(ls -al)

2. If you saved your testfile with the editor and than get wrong size.
Than your editor may have convert the newlines from UNIX to DOS without
asking. In a UNIX Text file LF stands for newline, while a dos textfile
uses CR+LF. This is a great example, why one shouldn't use some crappy
windows editor for Unix programming.

cheers
Luotao Fu





[ Post a follow-up to this message ]



    Re: Expertise Required With dd command  
pankaj_wolfhunter@yahoo.co.in


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-26-05 11:01 PM

hey thanx for reply. I got it what i want.
thanx again






[ Post a follow-up to this message ]



    Re: Expertise Required With dd command  
jussij@zeusedit.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-23-05 12:51 PM

> This is a great example, why one shouldn't use some
> crappy windows editor for Unix programming.

And any decent windows editor should be able to handle both
text file types:

http://www.zeusedit.com/features.html

Jussi Jumppanen
Author: Zeus for Windows






[ Post a follow-up to this message ]



    Re: Expertise Required With dd command  
Protocol Droid


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-23-05 12:51 PM

jussij@zeusedit.com wrote... 
>
> And any decent windows editor should be able to handle both
> text file types:
>
>    http://www.zeusedit.com/features.html
>
> Jussi Jumppanen
> Author: Zeus for Windows

I didn't see any Release Notes.  It'd be nice to know what the Known
Issues with Zeus are before considering changing editors.

--
"If you want peace, work for justice."  (H.L. Mencken 1880-1956)





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:27 AM.      Post New Thread    Post A Reply      
Pages (2): [1] 2 »   Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register