This is a discussion on Re: ^M character within the Informix forums, part of the Database Server Software category; --> select replace ( col1, substr(col1,-1,1),'') from table That should work according to the docs, but on my system I ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| select replace ( col1, substr(col1,-1,1),'') from table That should work according to the docs, but on my system I can't get the substr function to take the -1 the way it should. That substr function should be returning the last character of the string. I tested the replace function with select replace ( col1, substr(col1,6,1),'') from tablename. This was a 6 character string and it works but for that to work you'd need to know the length of all the columns. ======================== -<<Floyd Wellershaus>>- Database Administrator Unix Administrator email: fwellers@yahoo.com Home: 703-430-0805 Cell: 703-477-6045 ======================== http://www.one.org/ ----- Original Message ---- From: Dirk Moolman <DirkM@digicare.co.za> To: informix-list@iiug.org Sent: Friday, August 4, 2006 7:28:06 AM Subject: RE: ^M character My own problem is not removing these characters from the unload file, but removing them from the table before I do the unload. Any ideas ? Dirk -----Original Message----- From: Dirk Moolman Sent: 04 August 2006 01:27 PM To: 'Prateek Jain'; informix-list@iiug.org Subject: RE: ^M character This one should be easy. You can do this in a for-loop, and then use sed to do your search and replace for you. Or there is also a unix2dos command that can do this for you. One example, creating a new clean file, and overwriting the original one with the new file: For i in `find . -type f -print` Sed 's/^M//g' $i > /tmp/fixfile ##(where ^M is created by typing <ctrl-v><ctrl-m>) Mv /tmp/fixfile $i End for Or replace the sed command with a unix2dos command These are just simple example to give you an idea of how it could be done. ________________________________________ From: informix-list-bounces@iiug.org [mailto:informix-list-bounces@iiug.org] On Behalf Of Prateek Jain Sent: 04 August 2006 12:40 PM To: informix-list@iiug.org Subject: ^M character Hi guys, I have got files in directory and all the files have got ^M is there any way to replace all the ^M character in all the file recursively. -- Regards, Prateek Jain > The information on this e-mail including any attachments relates to the official business of DigiCare (Pty) Ltd. The information is confidential and legally privileged and is intended solely for the addressee. Access to this e-mail by anyone else is unauthorised and as such any disclosure, copying, distribution or any action taken or omitted in reliance on it is unlawful. Please notify the sender immediately if it has inadvertently reached you and do not read, disclose or use the content in any way. > No responsibility whatsoever is accepted by DigiCare (Pty) Ltd if the information is, for whatever reason, corrupted or does not reach its intended destination. The views expressed in this e-mail are the views of the individual sender and should in no way be construed as the views of DigiCare (Pty) Ltd, except where the sender has specifically stated them to be the views of DigiCare (Pty) Ltd. > http://196.33.167.71/digicare _______________________________________________ Informix-list mailing list Informix-list@iiug.org http://www.iiug.org/mailman/listinfo/informix-list |