\n removal between two |


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting \n removal between two |
# 8  
Old 05-20-2011
Quote:
Originally Posted by mayankgupta18
Ideally it must contain only one line but as all columns are | separated .
but data is coming in multi line
Look like your record-set is not complete , I think tr will fix your multiline problem.
Code:
tr -d \\n < file

# 9  
Old 05-20-2011
@danmero
Yup, ... the double cross-posts made my remark obsolete...
# 10  
Old 05-24-2011
I am still not able to convert the file.
Let me explain with example:

I am having one table in oracle with data type CLOB, and it contains data like :

See Attached as Table

Now when I am trying to export this in a text file with pipe separated using TOAD/SQL developer
Then it comes like:

Mayank|1|Fhfdsjhf
gadfjh
hdkhgkdg


Rahul|2|Fgjshagfuagf
gfjsadhgfjusa
ahfdagf
afjhgfjgahk

Bafj

Abhishek|3|Jgfsjakgf
fgusgushau
gabfjhkj


And when I am trying to insert this data in another table with Varchar column instead of CLOB, the table used to consider 2nd line of each record as New record ant try to load in 1st column, so it rejects the data.

And what I want is data must come like:

Mayank|1|Fhfdsjhf gadfjh hdkhgkdg
Rahul|2|Fgjshagfuagf gfjsadhgfjusa ahfdag fafjhgfjgahk Bafj
Abhishek|3|Jgfsjakgf fgusgushau gabfjhkj

--
Regards:
Mayank Gupta
Contact:0060143283396

Last edited by mayankgupta18; 05-24-2011 at 11:03 PM..
# 11  
Old 05-24-2011
Hi,

here's some mawk :
Code:
awk -F'|' 'BEGIN{OFS="|"; RS=""} {gsub("\n"," ",$3); print}' file

This User Gave Thanks to daPeach For This Post:
# 12  
Old 05-25-2011
Hi Da Peach,
I tried with the code that you have shared.
Still not able to perform what I want to do Smilie
Smilie

As this code use to replace only 1st record not all the records

Last edited by mayankgupta18; 05-25-2011 at 12:10 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removal of space

Hi , Can any one help me out how to remove space from below line select file_name from dba_data_files where tablespace_name='SYSTEM ----space---- '; i want as : select file_name from dba_data_files where tablespace_name='SYSTEM'; my code i use file=/u01/script/latest/tbs.temp while... (14 Replies)
Discussion started by: Praful Pednekar
14 Replies

2. Web Development

Vbseo removal

first off i want to thank you for such a great site, you helped me narrow down a long search on what was wrong with my forum, i have a large forum motorbicycling DOT com which i had someone remove vbseo before they went under because of all the security problems. anyway i have lots of 404 errors... (13 Replies)
Discussion started by: atcspaul
13 Replies

3. UNIX for Advanced & Expert Users

Duplicate removal

I have an input file of 5GB which contains duplicate records and have to remove duplicate records by retaing first instance of that record . Based on 5 fields the duplicates has to be removed . Kindly request to help me in writing a Unix Script. Thanks Asim (11 Replies)
Discussion started by: duplicate
11 Replies

4. UNIX for Dummies Questions & Answers

removal by substring

Hi guys, I am trying to remove lines that have a duplicate substring from any part in the file. So, for ex: 433043950359.3 5033 305935 2 2dd 5ffgs DOG43453552.A 3443565634 95460 3435 45 23d 56ggh DOG343211 3423895702359 34 66699 9455 2324 DOG43453552.B This is a very large file, and... (1 Reply)
Discussion started by: verse123
1 Replies

5. UNIX for Dummies Questions & Answers

removal of space from the end

HI, I need the help from the experts like I have created one file with text like: Code: a b c de f g hi j k l So my question is that i have to write the script in which like in the first sentence it will take only one space after d and remove all the extra space in the end.I dont... (0 Replies)
Discussion started by: bhanudhingra
0 Replies

6. OS X (Apple)

vi and special character removal

To the group, when I copy text from a web page that has the below java code , and then do the set list command in the vi editor, I see the $ symbol at the end of each line. I have searched the internet looking for a way to remove this from the file since it will not compile without errors..Please... (6 Replies)
Discussion started by: smartino
6 Replies

7. UNIX for Dummies Questions & Answers

semaphore removal

I have one process which creates semaphore with permission 600. Then at some part of the code I have line where this semaphore will be removed. Problem I have is that other processes in my program also try to execute this line of code. Of course since they dont have permission they wont be able to... (1 Reply)
Discussion started by: joker40
1 Replies

8. Homework & Coursework Questions

removal of files?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: remove all files and only files that the first three characters start with numerals. 2. Relevant commands,... (6 Replies)
Discussion started by: linuxtraining
6 Replies

9. UNIX for Dummies Questions & Answers

Removal of Data

Hi All, (And first up, a Happy New Year to you all! 363 days to go!) I need to make sure that our old Sun Sparcstations and Servers are clear of any Confidential data before I return them... Suggestions? I'm formatting the discs to make sure that there's nothing obvious, but would... (5 Replies)
Discussion started by: geralex
5 Replies

10. UNIX for Dummies Questions & Answers

Removal

I am using Unix as my OS on my server and would like to format my hard drive. How do I go about wiping my hard drive or is there a removal tool that I can use? (1 Reply)
Discussion started by: anaconda
1 Replies
Login or Register to Ask a Question

Featured Tech Videos