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


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

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-03-2012
Registered User
 
Join Date: Jul 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Record count in Unix servers

Hi All,

when i ftp the file from windows machine to unix server the record count in the file is decreased by 1.

example: Say a text file has three lines in it and when you place this file in unix server from your local machine and run a below command
cat filename | wc -l
the output is showing as 2

but when you create a same file and same lines in unix machine directly it will show record count a 3

Any idea why it so?

---------- Post updated at 07:23 PM ---------- Previous update was at 07:23 PM ----------

Record count of windows file in unix server
Sponsored Links
    #2  
Old 07-03-2012
...@...
 
Join Date: Feb 2004
Location: NM
Posts: 9,657
Thanks: 164
Thanked 645 Times in 622 Posts
UNIX does not like windows carriage control bytes - ascii 10 and ascii 13. UNIX carriage control for text files is just a single ascii 10. Called a newline character.

If you want things to work the way you expect all windows files moved to UNIX have to be run through the dos2unix (sometimes called dos2ux) command.
Sponsored Links
    #3  
Old 07-04-2012
methyl methyl is offline Forum Staff  
Moderator
 
Join Date: Mar 2008
Posts: 6,388
Thanks: 286
Thanked 668 Times in 640 Posts
... or do the ftp in ASCII mode (not BINARY mode).
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Validate record count balaji23_d Shell Programming and Scripting 6 12-01-2009 08:59 AM
replaying a record count with another record count er_zeeshan05 Shell Programming and Scripting 2 10-30-2008 12:14 AM
Record count of a csv file ajaykk Shell Programming and Scripting 5 07-17-2008 05:16 PM
record count dr46014 Shell Programming and Scripting 4 12-11-2007 03:39 PM
How to count the record count in an EBCDIC file. oracle8 UNIX for Dummies Questions & Answers 1 07-26-2006 07:22 PM



All times are GMT -4. The time now is 10:09 PM.