How do I fix a distorted text


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How do I fix a distorted text
# 1  
Old 02-24-2006
Bug How do I fix a distorted text

Hello
I am having some problem with my datatable file that I have imported. It was supposed to be tab-separated, however it turned out to be somewhat distorted. For lines in the file got broken inbetween. Now I need to join them back. May I know how I can do it with a AWK or SED or unix.
I would be most grateful if you could help me out here.

my table looks like this:
n-1,"b2172
",NULL,NULL,351,624,360,632,NULL,NULL,37,85,36,84,yes
n-2,"b2716
",NULL,NULL,350,577,343,553,NULL,NULL,37,83,35,82,yes
n-3,"b2980
",NULL,NULL,449,712,431,687,NULL,NULL,37,82,35,82,yes

output should look like this:

n-1,"b2172",NULL,NULL,351,624,360,632,NULL,NULL,37,85,36,84,yes
n-2,"b2716",NULL,NULL,350,577,343,553,NULL,NULL,37,83,35,82,yes
n-3,"b2980",NULL,NULL,449,712,431,687,NULL,NULL,37,82,35,82,yes

Thank you .
greenhorn
# 2  
Old 02-24-2006
Code:
sed -e :a -e '$!N;s/\n"/ /;ta' -e 'P;D' file1

# 3  
Old 02-24-2006
Code:
paste -d '\0' - - < myTable.txt

# 4  
Old 02-25-2006
Hello Bhargav
Thanks for your reply. I tried out the code but it did not change anything in my table. Is there a typo error somewhere?

greenhorn Smilie
# 5  
Old 02-25-2006
Hello vgersh99,
Your code works when I drop the zero in '\0'.
Thank you for your help!

happy greenhorn Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Match text to lines in a file, iterate backwards until text or text substring matches, print to file

hi all, trying this using shell/bash with sed/awk/grep I have two files, one containing one column, the other containing multiple columns (comma delimited). file1.txt abc12345 def12345 ghi54321 ... file2.txt abc1,text1,texta abc,text2,textb def123,text3,textc gh,text4,textd... (6 Replies)
Discussion started by: shogun1970
6 Replies

2. Solaris

Where is my memory? How to fix it ?

Hello, I have few Solaris 11.2 servers. Since sometime, we are noticing high memory utilization in them. Here is current config root@ser22-zonemgr:~# /tmp/memory.sh Physical memory size: 36864 Memory usage in MB: 32938 Memory usage in %: ... (4 Replies)
Discussion started by: ron323232
4 Replies

3. Red Hat

The English characters distorted after add a right to left language

i need for a right to left language support, in red hat EL6 , for repository problem, i never could to use from yum-solution, when i try from Gnu Desktop: Desktop --> system --> preference --> keyboard --> layouts --> Add and Add second language,the second language is ok but i lose English... (4 Replies)
Discussion started by: alwaystudent
4 Replies

4. Shell Programming and Scripting

Help me please to fix my error

Can you help me to fix my error please?! I checked the code and I think there is no mistake, but when I run it gives me error such line 1: /Users/Manu/trials/hosts: is a directory sort: open failed: /Users/Manu/trials/hosts/*: No such file or directory Help me please... mycode NAME value.... (9 Replies)
Discussion started by: Manu1234567
9 Replies

5. Shell Programming and Scripting

How to put delimiters in text files after fix characters?

Hi , i have a text file in which i want to put delimiters after certain characters ( fix),. like put a delimiter (any like ,) after 1-3 character than 4 than 5 than 6-17 ..... files looks like this (original)... (8 Replies)
Discussion started by: anamdev
8 Replies

6. Shell Programming and Scripting

How to fix line breaks format text for huge files?

Hi, I need to correct line breaks for huge files (more than 1MM records in a file) and then format it properly. Except the header and trailer, each record starts with 'D'. Requirement:Scan the whole file except the header and trailer records and see if any of the records start with... (19 Replies)
Discussion started by: kikionline
19 Replies

7. Shell Programming and Scripting

How to split a text after fix character count

HI, I want to split a text after certain fix character count in text. For eg: My file is containing text like: AURBJR,AURCID,AURVID,CHANDV,DAMNEW,DHMMAN,GANGAN,GARKHE,GOREGA,JEJKHA,JEJSHI,JINTUR,JMKKUS,JUNAWA,KALKAL,KHOJEW,KUNJIR,MAGARP,MAHAD, in this i want to print text after each... (5 Replies)
Discussion started by: vikash.rastogi
5 Replies

8. UNIX for Dummies Questions & Answers

spooled file getting distorted when sending through unix mail

Hi Folks, I'm spooling a file through sqlplus and sending using mailx but the output got distorted in MS-outlook. Thanks in advance (2 Replies)
Discussion started by: chgopi
2 Replies
Login or Register to Ask a Question