Sponsored Content
Top Forums Shell Programming and Scripting Delimiter Conversion(Generic Code) Post 302747989 by Arun Mishra on Monday 24th of December 2012 04:04:57 AM
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.
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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

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

7. 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

8. 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

9. 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
XML::SAX::Machines(3pm) 				User Contributed Perl Documentation				   XML::SAX::Machines(3pm)

NAME
XML::SAX::Machines - manage collections of SAX processors SYNOPSIS
use XML::SAX::Machines qw( :all ); my $m = Pipeline( "My::Filter1", ## My::Filter1 autoloaded in Pipeline() "My::Filter2", ## My::Filter2 " " " *STDOUT, ## XML::SAX::Writer also loaded ); $m->parse_uri( $uri ); ## A parser is autoloaded via ## XML::SAX::ParserFactory if ## My::Filter1 isn't a parser. ## To import only individual machines: use XML::SAX::Machines qw( Manifold ); ## Here's a multi-pass machine that reads one document, runs ## it through 5 filtering channels (one channel at a time) and ## reassembles it in to a single document. my $m = Manifold( "My::TableOfContentsExtractor", "My::AbstractExtractor", "My::BodyFitler", "My::EndNotesFilter", "My::IndexFilter", ); $m->parse_string( $doc ); DESCRIPTION
SAX machines are a way to gather and manage SAX processors without going nuts. Or at least without going completely nuts. Individual machines can also be like SAX processors; they don't need to parse or write anything: my $w = XML::SAX::Writer->new( Output => *STDOUT ); my $m = Pipeline( "My::Filter1", "My::Filter2", { Handler => $w } ); my $p = XML::SAX::ParserFactory->new( handler => $p ); More documentation to come; see XML::SAX::Pipeline, XML::SAX::Manifold, and XML::SAX::Machine for now. Here are the machines this module knows about: ByRecord Record oriented processing of documents. L<XML::SAX::ByRecord> Machine Generic "directed graph of SAX processors" machines. L<XML::SAX::Machine> Manifold Multipass document processing L<XML::SAX::Manifold> Pipeline A linear sequence of SAX processors L<XML::SAX::Pipeline> Tap An insertable pass through that examines the events without altering them using SAX processors. L<XML::SAX::Tap> Config file As mentioned in "LIMITATIONS", you might occasionally need to edit the config file to tell XML::SAX::Machine how to handle a particular SAX processor (SAX processors use a wide variety of API conventions). The config file is a the Perl module XML::SAX::Machines::SiteConfig, which contains a Perl data structure like: package XML::SAX::Machines::SiteConfig; $ProcessorClassOptions = { "XML::Filter::Tee" => { ConstructWithHashedOptions => 1, }, }; So far $Processors is the only available configuration structure. It contains a list of SAX processors with known special needs. Also, so far the only special need is the ConstructWithHashes option which tells XML::SAX::Machine to construct such classes like: XML::Filter::Tee->new( { Handler => $h } ); instead of XML::Filter::Tee->new( Handler => $h ); WARNING If you modify anything, apply your changes in a new file created from XML::SAX::Machines::SiteConfig.pm. On Debian systems, this should be placed in /etc/perl so that it is not overwritten during upgrade. Do not alter XML::SAX::Machines::ConfigDefaults.pm or you will lose your changes when you upgrade. TODO: Allow per-app and per-machine overrides of options. When needed. AUTHORS
Barrie Slaymaker LICENCE
Copyright 2002-2009 by Barrie Slaymaker. This software is free. It is licensed under the same terms as Perl itself. perl v5.10.0 2009-09-02 XML::SAX::Machines(3pm)
All times are GMT -4. The time now is 01:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy