| |||||||||||
| |||||||||||
Moving files between Windows / DOS and Linux / Unix
Text files written on a Windows or DOS operating system use a carriage return character (ASCII decimal equivalent 13) followed by a line feed (ASCII decimal equivalent 10) as their line terminator, but on Linux, Unix and OS X systems, just the line feed character is used. And sometimes you'll find that there's just a carriage return character used - I've seen it this morning with a DreamWeaver generated Style sheet, for example.
If you're transferring text files around, you'll want / need to convert them in some way, but is you're transferring binary files (such as .jpg) , conversion will damage the content beyond redemption. Here's a tiny utility that I use - a Perl program that converts a text file that's on a Unix / Linux / OS X box from an alien format to the local format. #!/usr/bin/perl -pYes - that's it! Makes use of Perl's topicalisation and awk mode command line options. The source code with comments is available here. I called it cv, put it in a directory on my executable path, and made it executable ... and here's a test: grahamellis$ od -c fiddle.txtOther ways of converting ... • if you transfer files through FTP in ASCII mode, the changes will be made during the transfer (and if you transfer a binary file in ASCII mode, you'll produce a damaged copy!) • if you read files into certain utilities / editors, they'll convert the input for you silently and / or work in an alien mode. This applies to vim and wordpad, but notepad can't cope. • Utilities dos2unix and unix2dos are available on some operating systems. (written 2006-12-30 09:16:48) Associated topics are indexed under A101 - Web Application Deployment - Linux -An Introduction For Users
Some other Articles
Modernising from tables to cascading style sheetsSearch engine placement - long term strategy and success Christmas Season Piccies Copy multiple files - confusing error message from cp Moving files between Windows / DOS and Linux / Unix Well House Manor and Beechfield House, Hotels, Melksham Dates, times, clickable diarys in PHP Passing GET parameters through Apache mod_rewrite Date conversion - PHP Friends and family 1636 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 at 50 posts per pageThis is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price. Link to Ezine home page (for reading). Link to Blogging home page (to add comments). |
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho | |||||||||||