APLawrence - Information and Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds Get APLawrence.com by RSS











(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Home > News Posts > doscp doscat line endings CRLF conversions ––>Re:Problems using doscp -r for import to access database
Printer Friendly Version




News Group Posts

doscp doscat line endings CRLF conversions


In "vi", you can ":set ff=dos" to set NL/CR correctly (or ":set ff=unix" and ":set ff=mac" too).

Nowadays, you may run into UTF-16 also.


From: rja.carnegie@excite.com (Robert Carnegie)
Newsgroups: comp.unix.sco.misc
Subject: Re: Problems using doscp -r for import to access database
Date: 10 Sep 2001 03:28:49 -0700
Message-ID: <f3f18bc0.0109100228.2f60f9f2@posting.google.com> 

btors@aol.com (BTors) wrote in message news:<20010906194224.17035.00000352@mb-cg.aol.com>...
> Robert:
> 
> Thanks for your reply!

I made one quite big mistake, see below...

> Just to clarify and answer some of your questions:
> 
> 1) There are no spaces in the file name.
> 2) It isn't too long only 5 characters
> 3)Using SCO Openserver 5.0.5
> 4) Tried doscp -m and it didn't work from command line. ( Didn't import
> correctly)
> 4a) doscp -r works from command line.

Ah.  Well, if the report program generating the file (we haven't discussed
that program) is creating a file with MS-DOS style line feeds, then
"doscp -m" will probably break it instead of fixing it.

> 5) I guess it isn't EOF mark. Looks like a single line with nothing on it but
> character that looks like paragraph symbol in word or notepad ( sorry I'm a
> beginner).

Could be ASCII 20 (hex 14), IBM 244 (hex F4), or Windows character 182
(hex B6), but I'm not aware that any of them mean anything much - 20
could be a control code for old Epson printers...?

Perhaps it would be healthier to strip it out of the file - the filter
'cat $fname.txt | tr -d \\024 >${fname}2.txt' will do that, if it's 20.

(\ here introduces an octal - number base 8 - character code, but it's
also the special 'escape' character in shell commands so that other
special characters lose their special effect - echo here\'s an example -
and so \\ is used so that the first \ tells the shell not to treat the
second \ as \, but to give it to 'tr'.  Actually 'tr -d "\024" would do ;-)

> 6) xtod didn't work either - I tried that
> 7) There is no error from doscp command.
> 8) I would love to use FTP but the computer isn't networked. THAT
>    wasn't my decision believe me!
> 9) Yes, my script does copy the right file but wrongly, from the command
>    line it works okay.

Still not sure how _that's_ happening.  If before your script was
called, a shell function named "doscp" had been defined -
which is just mean, frankly - you could specify /usr/bin/doscp...

> 10) In vi editor prior to converting there is no last line in the file.

"Incomplete last line" (no line feed at the end)?  "echo >>$fname.txt"
if you want one - and if the last line doesn't consist of ASCII code 20
and you decide to remove that.  Perhaps "echo \\r >>$fname.txt",
since you probably want the file to be Microsoft-style -
'echo "\r"' is carriage return.

> 11) I'll try the file inspection and doscat.

My big mistake here - mentioning "doscat" without considering that
it also requires a switch to enforce "raw" reading of data, without
conversion: "doscat -r device:filename.ext" .  Otherwise, what
you see would _not_ be what you just got - it would do another
conversion and show you that, instead - missing the whole point.

I usually use "debug" on files in MS-DOS or Windows, because I'm hard. ;-)

> 12) I'll give it one more try.

Good luck!
 

If this page was useful to you, please click to help others find it:  

Your +1's can help friends, contacts, and others on the web find the best stuff when they search.

Comments?




More Articles by



Click here to add your comments



Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar


cartoon
Versatile Site Map Generator $59.00
A1 Sitemap Generator

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.


My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!


book graphic unix and linux troubleshooting guide


 I sell and support
 Kerio Mail server
pavatar.jpg

This post tagged:

       - MacOSX
       - Microsoft
       - Shell
       - Unix




Unix/Linux Consultants

Skills Tests

Guest Post Here