Sponsored Content
Full Discussion: Split file by column value
Top Forums Shell Programming and Scripting Split file by column value Post 302747599 by newbie83 on Friday 21st of December 2012 06:13:25 PM
Old 12-21-2012
I was being stupid..thank you..Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to split a data file into separate files with the file names depending upon a column's value?

Hi, I have a data file xyz.dat similar to the one given below, 2345|98|809||x|969|0 2345|98|809||y|0|537 2345|97|809||x|544|0 2345|97|809||y|0|651 9685|98|809||x|321|0 9685|98|809||y|0|357 9685|98|709||x|687|0 9685|98|709||y|0|234 2315|98|809||x|564|0 2315|98|809||y|0|537... (2 Replies)
Discussion started by: nithins007
2 Replies

2. Shell Programming and Scripting

Split the file based on column

Hi, I have a file sample_1.txt (300k rows) which has data like below: * Also each record is around 64k bytes 11|1|abc|102553|125589|64k bytes of data 10|2|def|123452|123356|...... 13|2|geh|144351|121123|... 25|4|fgh|165250|118890|.. 14|1|abc|186149|116657|......... (6 Replies)
Discussion started by: sol_nov
6 Replies

3. UNIX for Dummies Questions & Answers

Split file based on column

i have file1.txt asdas|csada|130310|0423|A1|canberra sdasd|sfdsf|130426|2328|A1|sydney Expected output : on eaceh third and fourth colum, split into each two characters asdas|csada|13|03|10|04|23|A1|canberra sdasd|sfdsf|13|04|26|23|28|A1|sydney (10 Replies)
Discussion started by: radius
10 Replies

4. Shell Programming and Scripting

Split column using awk in a text file

chr1 412573 . A C 2758.77 . AC=2;AF=1.00;AN=2;DP=71;Dels=0.00;FS=0.000;HaplotypeScore=2.8822;MLEAC=2;MLEAF=1.00;MQ=58.36;MQ0=0;QD=38.86;resource.EFF=INTERGENIC(MODIFIER||||||||) GT:AD:DP:GQ:PL 1/1:0,71:71:99:2787,214,0 GATKSAM chr1 602567 rs21953190 A ... (9 Replies)
Discussion started by: mehar
9 Replies

5. Shell Programming and Scripting

Split file depending on Column Value

Hi , my file look likes below , cat file.csv 12/09/2014,50,5,0,300 12/09/2014, ,5,0,300 12/09/2014,50,,,300 i need to split file , the first one contains values (2nd column is 50 , 3rd and fourth column is null ) the second file contains all others firstfile ... (2 Replies)
Discussion started by: ubaisalih
2 Replies

6. Shell Programming and Scripting

Split file according to column values

Hi all, I am trying to split a file by the values of the FIRST column. The following awk works to split the file by the value of the LAST column -- How can I alter this to divide the column by the FIRST column?? awk -F"\t" '{ print > $NF ; close($NF)}' filename1Thanks! (5 Replies)
Discussion started by: owwow14
5 Replies

7. Shell Programming and Scripting

Split file by column value, each with header

Hello all, I have a csv with with different testcase values in column 5. year,min,max,Instrument,Testcase 2016,201,1003,GEOTROPH-02116,TATA7980 2016,53,1011,GEOTROPH-01963,TATA7980 2016,3,1024,GEOTROPH-02067,TATA7980 2016,203,1027,GEOTROPH-02011,TATA7980... (16 Replies)
Discussion started by: senhia83
16 Replies

8. Shell Programming and Scripting

How to split a file into column with awk?

The following is my code nawk -F',' ' BEGIN { printf "MSISDN,IMSI,NAM,TS11,TS21,TS22,OBO,OBI,BAIC,BAOC,BOIC,BOIEXH,APNID0,APNID1,APNID2,APNID3,APNID0,CSP,RSA\n" } { for(i=1; i<=NF; i++) { split($i,a,":") gsub(" ","", a) printf "%s;",a } printf "\n" }'HLR_DUMP_BZV >> HLR_full This is... (1 Reply)
Discussion started by: gillesi
1 Replies

9. Shell Programming and Scripting

Split file when value in column is blank

Hi Experts, In short : Need to split file when field in column 5 is blank and need to generate two file in which column 5 is blank and other in which column 5 has values along with other rows and column data My issue is i am not able to get header for column from raw file into new file which... (4 Replies)
Discussion started by: as7951
4 Replies

10. Shell Programming and Scripting

To Split the file based on column value

Hi Team, I have a requirement in such a way that need to split the file into two based on which column particular value appears.Please find my sample file below. Lets consider the delimiter of this file as either comma or two colons.(:: and ,). So I need to split the file in such a way that all... (2 Replies)
Discussion started by: ginrkf
2 Replies
Pod::Eventual(3)					User Contributed Perl Documentation					  Pod::Eventual(3)

NAME
Pod::Eventual - read a POD document as a series of trivial events VERSION
version 0.093330 SYNOPSIS
package Your::Pod::Parser; our $VERSION = '0.093330'; use base 'Pod::Eventual'; sub handle_event { my ($self, $event) = @_; print Dumper($event); } DESCRIPTION
POD is a pretty simple format to write, but it can be a big pain to deal with reading it and doing anything useful with it. Most existing POD parsers care about semantics, like whether a "=item" occurred after an "=over" but before a "back", figuring out how to link a "L<>", and other things like that. Pod::Eventual is much less ambitious and much more stupid. Fortunately, stupid is often better. (That's what I keep telling myself, anyway.) Pod::Eventual reads line-based input and produces events describing each POD paragraph or directive it finds. Once complete events are immediately passed to the "handle_event" method. This method should be implemented by Pod::Eventual subclasses. If it isn't, Pod::Eventual's own "handle_event" will be called, and will raise an exception. METHODS
read_handle Pod::Eventual->read_handle($io_handle, \%arg); This method iterates through the lines of a handle, producing events and calling the "handle_event" method. The only valid argument in %arg (for now) is "in_pod", which indicates whether we should assume that we are parsing pod when we start parsing the file. By default, this is false. This is useful to behave differently when reading a .pm or .pod file. read_file This behaves just like "read_handle", but expects a filename rather than a handle. read_string This behaves just like "read_handle", but expects a string containing POD rather than a handle. handle_event This method is called each time Pod::Evental finishes scanning for a new POD event. It must be implemented by a subclass or it will raise an exception. handle_nonpod This method is called each time a non-POD segment is seen -- that is, lines after "=cut" and before another command. If unimplemented by a subclass, it does nothing by default. handle_blank This method is called at the end of a sequence of one or more blank lines. If unimplemented by a subclass, it does nothing by default. EVENTS
There are four kinds of events that Pod::Eventual will produce. All are represented as hash references. Command Events These events represent commands -- those things that start with an equals sign in the first column. Here are some examples of POD and the event that would be produced. A simple header: =head1 NAME { type => 'command', command => 'head1', content => "NAME ", start_line => 4 } Notice that the content includes the trailing newline. That's to maintain similarity with this possibly-surprising case: =for HTML We're actually still in the command event, here. { type => 'command', command => 'for', content => "HTML We're actually still in the command event, here. ", start_line => 8, } Pod::Eventual does not care what the command is. It doesn't keep track of what it's seen or whether you've used a command that isn't defined. The only special case is "=cut", which is never more than one line. =cut We are no longer parsing POD when this line is read. { type => 'command', command => 'cut', content => " ", start_line => 15, } Waiving this special case may be an option in the future. Text Events A text event is just a paragraph of text, beginning after one or more empty lines and running until the next empty line (or =cut). In Perl 5's standard usage of Pod, text content that begins with whitespace is a "verbatim" paragraph, and text content that begins with non- whitespace is an "ordinary" paragraph. Pod::Eventual doesn't care. Text events look like this: { type => 'text', content => "a string of text ending with a ", start_line => 16, } Blank events These events represent blank lines (or many blank lines) within a Pod section. Blank events look like this: { type => 'blank', content => " ", start_line => 21, } Non-Pod events These events represent non-Pod segments of the input. Non-Pod events look like this: { type => 'nonpod', content => "#!/usr/bin/perl use strict; use Acme::ProgressBar ", start_line => 1, } AUTHOR
Ricardo SIGNES <rjbs@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2009 by Ricardo SIGNES. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.16.3 2009-11-29 Pod::Eventual(3)
All times are GMT -4. The time now is 06:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy