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 ]
|