|
Home > Archive > Unix Programming > March 2004 > How can I erase these blank lines
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How can I erase these blank lines
|
|
| Han JIANG 2004-03-30, 12:35 pm |
| Hi,
I am a newbie on unix. I met a strange problem here on Origin 2000.
I created a text data file which had 1,000 lines on my pc (Windows of
course) and upload it to my acoount on Origin.When I use vi to edit it on
Origin, I found there is a additional blank line between every 2 lines!
That makes my program cann't input this datafile.
Who know what happen here? And how can erase these additional blank lines?
Please don't say erase them line by line since I have 1000 lines there.
Thanks!
| |
| Pascal Bourguignon 2004-03-30, 1:41 pm |
| "Han JIANG" <jianghanunl@yahoo.com> writes:
> Hi,
> I am a newbie on unix. I met a strange problem here on Origin 2000.
>
> I created a text data file which had 1,000 lines on my pc (Windows of
> course) and upload it to my acoount on Origin.When I use vi to edit it on
> Origin, I found there is a additional blank line between every 2 lines!
> That makes my program cann't input this datafile.
>
> Who know what happen here? And how can erase these additional blank lines?
> Please don't say erase them line by line since I have 1000 lines there.
You transfered your text file as binary data, and your editor is
taking each CR of the MS-DOS CR-LF end-of-line sequence for a new line.
You should remove these CR, for example with tr:
tr -d '\015' < transfered-file.msdos > transfered-file.txt
When you transfer text file with ftp, you should tell it it's text
file typing the command:
ascii
before:
put file
--
__Pascal_Bourguignon__ http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he doesn't
want merely because you think it would be good for him.--Robert Heinlein
http://www.theadvocates.org/
| |
| Steve Cousins 2004-03-30, 2:41 pm |
|
Han JIANG wrote:
> I created a text data file which had 1,000 lines on my pc (Windows of
> course) and upload it to my acoount on Origin.
How was it uploaded? If you use FTP or scp, make sure it is in ASCII
mode and it will translate the CR/LF's to just LF when you are going
from Windows to UNIX, and vice-versa.
Otherwise, use the IRIX commands to_unix and to_dos to do the
translation.
Steve
________________________________________
_____________________
Steve Cousins Email: cousins@umit.maine.edu
Research Associate Phone: (207) 581-4302
Ocean Modeling Group
School of Marine Sciences 208 Libby Hall,
University of Maine Orono ME 04469
|
|
|
|
|