dos to unix on Linux environment
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 122
- Joined: Mon Jul 05, 2004 1:33 pm
- Location: MA
dos to unix on Linux environment
Hi All,
I use dos2unix to convert source files on the windows machine to unix file on a SunSolaris machine. After which I can process the file without the option "Record Delimitor String = Dos format". on the sequential file stage
But dos2unix does not seem to work on a Linux box.
Has anyone tried dos2unis on linux?, faced similar issue?
I use dos2unix to convert source files on the windows machine to unix file on a SunSolaris machine. After which I can process the file without the option "Record Delimitor String = Dos format". on the sequential file stage
But dos2unix does not seem to work on a Linux box.
Has anyone tried dos2unis on linux?, faced similar issue?
Regards
Sonia Jacob
Sonia Jacob
dos2unix and unix2dos are present on some platforms. Try doing man dos2unix or man unix2dos, if there is help present, then it is most probably supported. Only your id doesnt have access to it. You need to contact your system admin for that.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Don't know if it exists on Linux or not. But even if it does, it may be in a directory not mentioned in your PATH environment variable (which specifies the directories to be searched when looking for a command).
What error message is generated?
What error message is generated?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 122
- Joined: Mon Jul 05, 2004 1:33 pm
- Location: MA
command and error
Command : dos2unix file.csv file2.csvray.wurlod wrote:Don't know if it exists on Linux or not. But even if it does, it may be in a directory not mentioned in your PATH environment variable (which specifies the directories to be searched when looking for ...
Error:
dos2unix: converting file file.csv to UNIX format ...
dos2unix: problems converting file file.csv
Regards
Sonia Jacob
Sonia Jacob
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
Like previously asked by DSGuru2B, do you have permission to write in the directory where your output file exists. Just want to make sure that this is not a permissions issue.
Whale.
Whale.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Try
Code: Select all
dos2unix file1 > file2
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
OK, that error message tells you that dos2unix does exist on your server machine, since it was the dos2unix command itself that generated the error message.
It's also telling you that there's something about file.csv that it did not like - could not convert. You will need to scrutinize file.csv with an intense scrute (or a hex editor) to work out what this is - maybe the FTP utility automatically converted the line terminators.
It's also telling you that there's something about file.csv that it did not like - could not convert. You will need to scrutinize file.csv with an intense scrute (or a hex editor) to work out what this is - maybe the FTP utility automatically converted the line terminators.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
FTP can convert it, I wouldn't say 'does'. Way too many packages seem to default to a binary transfer which means you end up with a DOS file on your UNIX system.
However, if you know that's what you are going to get why not just read it as a DOS file? Curious what's so horrible about using the DOS record delimiter setting?
However, if you know that's what you are going to get why not just read it as a DOS file? Curious what's so horrible about using the DOS record delimiter setting?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Well, I have always created test files on my desktop and ftp'd them over to the unix environment. Just a simple put command. It would convert it. No special command to convert it along with ftp. That is due to the fact that command line ftp uses ascii transfer mode as a default mode. The recieving machine saves those transfered bytes in the appropriate format, i.e, unix saves it in unix format, machintosh saves it in Mac format and so on.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
No-one except gomers like us would use command line ftp from a Windows box.
Here, any business type folk who provide Excel csv files (typically) via ftp all use some sort of GUI package... and for that same reason we practically always get DOS files as a result. Go figure.
Here, any business type folk who provide Excel csv files (typically) via ftp all use some sort of GUI package... and for that same reason we practically always get DOS files as a result. Go figure.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Well, i guess then the OP needs to either convert the format explicity like he/she has been trying or as Craig said, use Dos record end setting. Check out thislink for a few more ways of doing that.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 122
- Joined: Mon Jul 05, 2004 1:33 pm
- Location: MA
chulett wrote:No-one except gomers like us would use command line ftp from a Windows box.
Here, any business type folk who provide Excel csv files (typically) via ftp all use some sort of GUI package... and for that same reason we practically always get DOS files as a result. Go figure.
We have all our sources files put on a Windows machine which is mounted on a Unix box (its like having mapped drive)DSguru2B wrote:Well, I have always created test files on my desktop and ftp'd them over to the unix environment. Just a simple put command. It would convert it. No special command to convert it along with ftp. That is due to the fact that command line ftp uses ascii transfer mode as a default mode. The recieving machine saves those transfered bytes in the appropriate format, i.e, unix saves it in unix format, machintosh saves it in Mac format and so on.
ETL connects to the windows directory using a sequential stage and reads the file with a records delimitor = DOS format. And we were good
Now the source files (.csv) started to have blank lines in them which sequential stage does not like. Hence we called a shell script that would convert the file to unix move to the unix etl server and remove the blank lines.
Before have a shell script to remove blank lines I did try to use reject link hoping that the sequential stage would just reject the record which is not per the format (blank lines). But it throws a warning which is a issue to us.
Regards
Sonia Jacob
Sonia Jacob