Hello All
I am producing a fixed width file with a carriage return in the last column of each record in the file. The business wants carriage return on all other records except the last record. Can anyway suggest me how can I remove the carriage return at the EOF. If possible, I don't want to remove the carriage return but replace the last carriage return with a space. That way I maintain the fixed length of the record intact.
Thanks
Remove Carriage Return from the end of the file
Moderators: chulett, rschirm, roy
Remove Carriage Return from the end of the file
Regards
Kashif Khan
Kashif Khan
-
- Premium Member
- Posts: 730
- Joined: Tue Nov 04, 2008 10:14 am
- Location: Bangalore
I have already tried various Sequential file options but it did not help. I am looking for a UNIX command to fix this issue.
Following is the scenario. I have a file called "file1" which has the following content.
abc
xyz
123
etc
etc
etc
<-------------------- Blank line to remove
How do I get ride of this blank line at the end. I have already tried the following SED command
sed "$d" file1 > file2
but the carriage return does not go away.
Following is the scenario. I have a file called "file1" which has the following content.
abc
xyz
123
etc
etc
etc
<-------------------- Blank line to remove
How do I get ride of this blank line at the end. I have already tried the following SED command
sed "$d" file1 > file2
but the carriage return does not go away.
Regards
Kashif Khan
Kashif Khan
Re: Remove Carriage Return from the end of the file
Hi,
Read the file as a single varchar column(without data length) , remove the blank line based on the length.Use column export to split the records into multiple columns
-Paul
Read the file as a single varchar column(without data length) , remove the blank line based on the length.Use column export to split the records into multiple columns
-Paul
-
- Premium Member
- Posts: 730
- Joined: Tue Nov 04, 2008 10:14 am
- Location: Bangalore