Remove Extra Delimiter

Thread Tools Search this Thread
# 8  

I apologize for that Logic

The logic of 3rd row is correct

I want to applied same logic with all row and want to remove extra delimiter(|)

I want data like this

Code :
aaa |bbbb |cccc |dddd |fff |dsaaFFDFD|
Adsads |sas |saas |asa |saddas |dsasdsdad|
dsas |dss |ssssss|ddd |dssd |rrrfddf |
www |fff |refd |dads |fsdf |00sd |
5fgdg |dfs00|d55f |sfds55|445fsd |55dssdf |
# 9  
It's still unclear which extra delimiters to remove. For example, line three has eight delimiters, so we need to remove two. We could remove #1 and #3, or #1 and #4, etc.
# 10  
Hi ,

I apologize for that,

Code :
aaa |bbbb |cccc |dddd |fff |dsaaFFDFD|
Adsads |sas |saas |asa |saddas |dsasdsdad |
dsas |dss |ssssss|ddd |dssd |rrrfddf |
www |fff |refd |dads |fsdf |00sd |
5fgdg |dfs00|d55f |sfds55 |445fsd |55dssdf |

the logic for the third row is correct . but issue is that ,i am not able to set pattern in sed command .here data is varchar ,but if the data is in numeric or Date format so how to set pattern .
# 11  
the logic for the third row is correct
But what is the logic? We could remove #1 and #3, or #1 and #4, etc. What's the rule?

And use those code tags... Smilie
This User Gave Thanks to hanson44 For This Post:
# 12  

sorry ,
leave that code .

here below is the another code .please let me know how you will remove extra delimiter and how will you set pattern for Varchar and numeric data in sed command.

Code :
aaa |bbbb |cccc |dddd |sas52 |10adaw|59 |abced
Adsads |sas |saas |asa |ccfc |10adaw|59 |abced
dsas |dss |ss|ss |ddd |dfsdd |caas |59 |abc|ed
www |fff |refd |dads |xdsx |10adaw|59 |abced
5fgdg |dfs00|d55f |sfd|s55|sas52 |10adaw|5|9|abced

The extra delimiter are in red color

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Science: Gadgets
Difficulty: Easy
Microphones can be used not only to pick up sound, but also to project sound similar to a speaker.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

File Containing Extra delimiter should be removed

The input file is this: a|b|c|d x|y|z|n||||||||| p|q|r|s||| g|h|i| w|e|r|| Now as per requirement , each row should have only 3 delimiter. Now the 2nd row & last row has an extra delimiter, How to remove that ? In some large file having 100K data , there can be 100 such rows having... (4 Replies)
Discussion started by: ikdKunal
4 Replies

2. Shell Programming and Scripting

Extra Space in output - remove

Hi All I am trying to perform the below operation -count=`cat abc.txt | wc -l` echo$count 5 Head=Start"$DATE"00000"$count"File echo $HEAD START15020300000 5File There is a space coming before 5 which is not needed . How to ignore that . (4 Replies)
Discussion started by: honey26
4 Replies

3. Shell Programming and Scripting

Remove of extra spaces from the trailing

HI, I need the help from the experts like I have created one file with text like: a b c d e f g h i 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... (8 Replies)
Discussion started by: bhanudhingra
8 Replies

4. UNIX for Dummies Questions & Answers

how to remove extra characters

Guys, I have a file that contains entries like this: LaxOrdID=19220288<8> LaxOrdID=19220288 I would like to remove <> and the values inside it anywhere its found. How? (2 Replies)
Discussion started by: DallasT
2 Replies

5. Shell Programming and Scripting

Remove extra character

Hi I am using cat <filename> command in one of my datastage job(Command Activity). It is giving actual value but giving extra line. Eg: Displayed Output: 1 and showing extraline(Eg: 1 ) I had checked even wc -c it is giving one character extra. If the file contains 11. wc -c says 3. ... (3 Replies)
Discussion started by: cnrj
3 Replies

6. Shell Programming and Scripting

How to remove extra spaces from a string??

Hi, I have a string like this and i want to remove extra spaces that exists between the words. Here is the sentence. $string="The small DNA genome of hepadnaviruses is replicated by reverse transcription via an RNA intermediate. This RNA "pregenome" contains ... (2 Replies)
Discussion started by: vanitham
2 Replies

7. Shell Programming and Scripting

remove extra spaces between fields

Hi, I have a source file as mentioned below: I want to remove all the extra spaces between the fields. a b--------|sa df-------|3232---|3 sf sa------|afs sdf-----|43-----|33 a b c------|adfsa dsf---|23-32|23 *Here '-' idicates spaces Now, I want output as below: a b|sa df|3232|3... (7 Replies)
Discussion started by: srilaxmi
7 Replies

8. Shell Programming and Scripting

Remove extra spaces in a line

Hi, I need a help in deleting extra spaces in a text. I have a huge file, a part of it is :- 3 09/21/08 03:32:07 started undef mino Oracle Message Text : The Oracle session with the PID 1103 has a CPU time ... (6 Replies)
Discussion started by: vikas027
6 Replies

9. UNIX for Dummies Questions & Answers

To remove the extra spaces in unix

Hi... I am quite new to Unix and would like an issue to be resolved. I have a file in the format below; 4,Reclaim,ECXTEST02,abc123,Harry Potter,5432 6730 0327 5469,0603,,MC,,1200,EUR,sho-001,,1,,,abc123,1223 I would like my output to be as follows; 4,Reclaim,ECXTEST02,abc123,Harry... (4 Replies)
Discussion started by: Sho
4 Replies

10. Shell Programming and Scripting

remove extra lines in the file

Hi, I have some files, with some extra lines in weird characters on the top and bottom of the. I want to get rid of those line. Is there a way I can do that? example of the input file. I want to get rid of those lines in bold  ... (8 Replies)
Discussion started by: CamTu
8 Replies

Featured Tech Videos