Urgent.reading files in linux. [message #99252] |
Wed, 29 December 2004 01:17 |
Samyak
Messages: 10 Registered: August 2004
|
Junior Member |
|
|
hi,
i have a text file containing multiple lines in windows.my oracle database is on a linux machine which reads this file.i am able to read this file from linux via samba.but the problem i am now facing is ... linux is not able to read ^M character present in the text file.i tried the dos2unix command to convert the text file.no doubt it eliminated the ^M character but now the multiple lines appearing in original text file now appears in a single line.is there anyway by which only the ^M character will be removed but the text files will appear in multiple lines instead of one.
thanks in advance and it is very urgent please.
regards,
sam
|
|
|
|
|
Re: Urgent.reading files in linux. [message #99255 is a reply to message #99254] |
Wed, 29 December 2004 02:18 |
Daniel Kingshott
Messages: 9 Registered: March 2004
|
Junior Member |
|
|
You can't read all files through this automatically, besides, why whould you want to and isn't that a bit stupid? it would also waste a lot of processor power.
Instead save the .txt file in the correct format within notepad or what ever, set the encoding to (I believe UTF-8 or Unicode)
OR even better, use a linux desktop :)
dan.
|
|
|
Re: Urgent.reading files in linux. [message #99256 is a reply to message #99255] |
Wed, 29 December 2004 02:53 |
Samyak
Messages: 10 Registered: August 2004
|
Junior Member |
|
|
this is because our system is a huge one in terms of processing information....
here a lot of say about 10000 files per day will be downloaded
into a windows machine....now the database which is on linux will read all these files and process them accordingly....now it will be quite tedious to type the command dos2unix everytime for each file and remove the ^M character from the file and then it can be used for processing... morever the multiple lines of the windows file are converted into a single line after removal of ^M character which will make really difficult to know where the line really breaks...
that is the problem.....hope u understood....
thanks......
|
|
|
Re: Urgent.reading files in linux. [message #99257 is a reply to message #99256] |
Wed, 29 December 2004 03:00 |
Daniel Kingshott
Messages: 9 Registered: March 2004
|
Junior Member |
|
|
Well not knowing the ins and outs of your system I can't suggest a specific solution, you will probably have to write a shell script of some sort to process the files as they are placed on the system.
If the 10k files a day are being generated automatically you might want to speak to author of the program generating the files in the first place and ask them to amend the coding of the files.
Other wise, you could try something funky like this:
find /somewhere/on/your/filesystem/where/the/files/live -ctime -2min -exec dos2unix {} ;
and schedule it to run once every 2 minutes, this will look for files created within the last two minutes and process them with dos2unix.
hth,
dan.
|
|
|
Re: Urgent.reading files in linux. [message #99258 is a reply to message #99257] |
Wed, 29 December 2004 03:33 |
Samyak
Messages: 10 Registered: August 2004
|
Junior Member |
|
|
actually the author of the files is an automated system itself...ofcourse third party....
anyway your suggestion is worth a try....
thanks a lot for your views and taking pains to reply....
regards,
sam
|
|
|