![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| remove first column of a space delimited txt | ajp7701 | Shell Programming and Scripting | 1 | 04-18-2008 01:10 PM |
| remove space characters | melanie_pfefer | Shell Programming and Scripting | 1 | 03-11-2008 10:45 AM |
| remove space in front or end of each field | happyv | Shell Programming and Scripting | 6 | 03-21-2007 11:05 PM |
| string remove | gundu | Shell Programming and Scripting | 1 | 03-16-2005 04:08 PM |
| remove files with 0 size, space and double qoute | nongrad | Shell Programming and Scripting | 3 | 02-08-2002 12:32 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I need to unload some data from Informix database into text file. But what happen is when i open the text file, some record split into 2 line, become uncomplete. I had checked is due to some unregconized space in particular fields, i used many way to detect this unregconized space, but failed, because it is not null, not blank, not space, trim() also cannot help. here is sample of the record in text file: 1337851|^M\ KAMPUNG SUNGAI SAMAK| 10000|NO 3 PRSN KLEDANG 12| the 2nd column contain some funny character ^M, then direct goto 2nd line. Need your guys help urgently. Thanks Regards Eelyn |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Put your sample record in a text file and enter this command:
Code:
od -t oC -An input_file You may also try: Code:
od -t a input_file |
|
#3
|
|||
|
|||
|
Hi Robotronic,
Thanks a lot for your reply, by using the od command, i able to detect the octal code 012 is the one cause newline \n in my text file. But how should i write my coding to detect this octal code and remove it in informix 4GL program? Thanks Regards Eelyn |
|
#4
|
||||
|
||||
|
Well, "\012" is nothing strange, it's a simple newline character (\n). I notice in your first post that there is a "^M"... Maybe is the symptom that the input file is in DOS format.
The first recommendation is trying to convert the input file into unix format and then look in the output if the unwanted newlines are gone: Code:
dos2unix input_file converted_file.txt Code:
cat input_file | tr -d '\n' |
||||
| Google The UNIX and Linux Forums |