Delimiter Conversion(Generic Code)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Delimiter Conversion(Generic Code)
# 1  
Old 12-24-2012
Power Delimiter Conversion(Generic Code)

Hi All,

I am looking for a generic code which can search for the existing delimiter(what ever it may be) in a file and convert it to Pipeline. The file may have Pipeline delimiter already in that case just leave it. Please find below some sample records.
Sample records1:
HTML Code:
IMSDR,"Competitive,Segment","Decile_Augmented","Speicalty","In_Current_STP","MCR_Target","MCRO_Target","CVAS_Target","PR_Target","OCEAN_Target"
"0000230","GENERIC",9,"PCP","Y","Y","N","N","N","N"
"0000326","GENERIC",7,"PCP","Y","Y","N","N","N","Y"
"0000340","HIGH CRESTOR",6,"PCP","Y","Y","N","N","N","N"
Sample records2:
HTML Code:
IMS Model Type|Retail Method of Payment
CASH|CASH
FFS MED|MEDICAID
MEDICAID |COMMERCIAL THIRD PARTY
MGD MEDI|COMMERCIAL THIRD PARTY
CHIP|COMMERCIAL THIRD PARTY
MED B |COMMERCIAL THIRD PARTY
I need to make sure the headers are removed.
Any help as always appreciated.
# 2  
Old 12-24-2012
Have you read the tr man pages?



Robin
# 3  
Old 12-24-2012
Not sure I understand. Do you know the delimiter from the beginning? Then use rbatte1's proposal. If you don't, I guess you're lost. How do you want a generic code to guess the delimiters that can be any character? Even more between other (like double quote) chars for special treatment?
And how do you want the code to tell header lines from data lines?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl Code to change file delimiter (passed as argument) to bar delimiter

Hi, Extremely new to Perl scripting, but need a quick fix without using TEXT::CSV I need to read in a file, pass any delimiter as an argument, and convert it to bar delimited on the output. In addition, enclose fields within double quotes in case of any embedded delimiters. Any help would... (2 Replies)
Discussion started by: JPB1977
2 Replies

2. Shell Programming and Scripting

Shell script to put delimiter for a no delimiter variable length text file

Hi, I have a No Delimiter variable length text file with following schema - Column Name Data length Firstname 5 Lastname 5 age 3 phoneno1 10 phoneno2 10 phoneno3 10 sample data - ... (16 Replies)
Discussion started by: Gaurav Martha
16 Replies

3. Shell Programming and Scripting

conversion of code in perl and python

How to convert below bash code in perl and python. for BLOCK in /sys/block/emcpow* do echo "100000" > "$BLOCK"/queue/nr_requests echo "noop" > "$BLOCK"/queue/scheduler done (2 Replies)
Discussion started by: learnbash
2 Replies

4. Shell Programming and Scripting

How to cut by delimiter, and delimiter can be anything except numbers?

Hi all, I have a number of strings like below: //mnt/autocor/43°13'(33")W/ and i'm trying to get the numbers in this string, for example 431333 please help thanks ahead (14 Replies)
Discussion started by: sunnydanniel
14 Replies

5. UNIX for Advanced & Expert Users

Conversion from ASCII to binary for physical simulation code in C/C++

Good evening, everybody A good math friend told me that it would be possible to shrink the size of the numerical datas I produce with a physical simulation code I programmed for my PhD. It usually writes at least 100 GB to complete the simulation, and it seems that it is too high. There are... (7 Replies)
Discussion started by: Cybertib
7 Replies

6. Shell Programming and Scripting

Conversion of '|' delimiter

Hello All, I want to convert the data saparated by '|' delimited in the flat file to the readable format. The every odd number '|' (pipe) to be converted to '\tab' and every even numbered '|' to '\n' and transfer the data to another file. example. ... (12 Replies)
Discussion started by: ssachins
12 Replies

7. Shell Programming and Scripting

Substring based on delimiter, finding last delimiter

Hi, I have a string like ABC.123.XYZ-A1-B2-P1-C4. I want to delimit the string based on "-" and then get result as only two strings. One with string till last hyphen and other with value after last hyphen... For this case, it would be something like first string as "ABC.123.XYZ-A1-B2-P1" and... (6 Replies)
Discussion started by: gupt_ash
6 Replies

8. Solaris

Generating a generic incremental code

Hi Gurus, I have several Solaris systems (say system a, system b,system c) which will connect to a windows system (system Z) using SFTP session. I have a 'txt' file on System Z , which has a simple numeric value on it(say 1) , If I have to increment this number with 1 (1+1 =2) irrespective of... (3 Replies)
Discussion started by: ramky79
3 Replies

9. Shell Programming and Scripting

Code conversion from JSP to PYTHON

Guys I need to convert a code from JSP (Java Tags are also there inside JSP) to PYTHON. I have OK kind of knowledge in PYTHON, but dont have a muck knowledge in JAVA/JSP. Any idea how to approach? Thanks in advance to all C Saha (1 Reply)
Discussion started by: csaha
1 Replies
Login or Register to Ask a Question