The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
unix file size becomes zero ananthmm Filesystems, Disks and Memory 1 10-01-2006 08:12 AM
how to find the file size in unix lmraochodisetti UNIX for Advanced & Expert Users 4 07-24-2006 04:20 AM
checking the size of unix cd on windows platform johnjsm Windows & DOS: Issues & Discussions 2 12-09-2004 01:49 AM
Unix file size - HP-UX krishna7 HP-UX 2 07-18-2003 08:58 AM
Hp Unix file size problem A Roberts UNIX for Dummies Questions & Answers 3 11-29-2001 04:50 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-02-2007
Registered User
 

Join Date: Apr 2007
Posts: 75
file size different in unix and windows

I have a file on solaris/linux.

ls -ls shows the logical size to be: 13292

However, when I transfer the file to my windows machine.. Rightclick->Properties shows the file size as: 13421

I wrote a small program on unix and windows that does a stat() on the file and reports the st_size (file size in bytes) and I get the same result (13292 on windows and 13421 on unix)

Interestingly, this happens only with .txt files. For .pdf and .ppt files, the file size is the same. However, for .txt files the file size on windows is > that on unix.

For another txt file (17MB)
Windows: 18701307 bytes
Unix: 18581191

Does anybody know why is this happening ?

Thanks !
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-02-2007
jgt jgt is offline
Registered User
 

Join Date: Apr 2007
Location: 44.21.48N 80.50.15W
Posts: 348
Unix text file end each line with a line feed character.
DOS/Windows text files end each line with a carriage return and line feed.
Because of this, there is one additional character in a DOS/Windows file for each line in the file. Your file contains 13421 - 13292 = 129 lines.
When you transfer the file from Unix to DOS using ascii mode in ftp, this conversion takes place automatically. If you use binary mode, no conversion takes place.
Reply With Quote
  #3 (permalink)  
Old 08-02-2007
Registered User
 

Join Date: Apr 2007
Posts: 75
Brilliant ! that explains everything ! Thanks a lot for your help.
Reply With Quote
  #4 (permalink)  
Old 08-02-2007
Registered User
 

Join Date: Oct 2004
Posts: 221
Nice explanation .. Great !
Reply With Quote
  #5 (permalink)  
Old 08-03-2007
psiva_arul's Avatar
Registered User
 

Join Date: Jul 2007
Location: Bangalore, India
Posts: 78
Great jgt...

Nice explanation "jgt"...

Rgds,
Siva.P
Reply With Quote
  #6 (permalink)  
Old 08-03-2007
psiva_arul's Avatar
Registered User
 

Join Date: Jul 2007
Location: Bangalore, India
Posts: 78
different Between the "awk" and "nawk"?

what is the different between the "awk" and nawk" Programme in unix? i have some knowledge in awk concept in unix but i don't know about the "nawk" concept.

Can you any one help me ?

Regards,
Siva.P
Bangalore
Reply With Quote
  #7 (permalink)  
Old 08-03-2007
sysgate's Avatar
Unix based
 

Join Date: Nov 2006
Location: /root
Posts: 1,160
Awk is the orignal awk. Nawk is "new awk" - (An enhanced version of AWK, with dynamic regular expressions, additional built-ins and operators, and user-defined functions.) and gawk is the "gnu awk"
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux, regex, regular expressions

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:42 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0