Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to extract one column from csv file in perl? Post 302475770 by kvth on Monday 29th of November 2010 11:45:05 PM
Old 11-30-2010
here is the entire code..!!

here is the entire code..what i am using right now..!!


Code:
 
#!C:/perl/bin
use warnings;
use strict;
 
my $file1 = $ARGV[0];
my @input = "";
my @line;
open FILE1, "<$file1"
    or die "Can't open $file1: $!\n";
 
     while(<FILE1>)
       
       my @line = split(/,/, $_);
       $line[19] = 10;
       foreach(@line)
       {
       print "$_\t";
       }
       print "\n";

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract values from column with Perl

Hi everybody I have some problems with PERL programming. I have a file with two columns, both with numeric values. I have to extract the values > 50 from the 2nd columns and sum them among them. The I have to sum the respective values in the first column on the same line and, at the end, I... (6 Replies)
Discussion started by: m_elena
6 Replies

2. Shell Programming and Scripting

extract csv based on column value

Hi I have a csv file which is below A,5 B,6 C,10 D,7 I want the values who's second column is greater than 7 say C,10 D,7 Help me please... Thanks, Maruth (3 Replies)
Discussion started by: maruthavanan
3 Replies

3. Shell Programming and Scripting

Perl script to extract second column from a xls

Can Anyone tell me how to extract the second column of a xls sheet And compare the content of each row of the column with a .h file. xls sheet is having only one spreadsheet. (2 Replies)
Discussion started by: suvenduperl
2 Replies

4. Shell Programming and Scripting

Extract first column from second line in perl

Hello Gurus I have a source file which has the first line as header and the rest are the records I need to extract the first column from the second line to extract a value I/P ... (7 Replies)
Discussion started by: Pratik4891
7 Replies

5. Shell Programming and Scripting

3 column .csv --> correlation matrix; awk, perl?

Greetings, salutations. I have a 3 column csv file with ~13 million rows and I would like to generate a correlation matrix. Interestingly, you all previously provided a solution to the inverse of this problem. Thread title: "awk? adjacency matrix to adjacency list / correlation matrix to list"... (6 Replies)
Discussion started by: R3353
6 Replies

6. Shell Programming and Scripting

Perl code to grep a particular column in CSV format

Hi I want to grep a column 6 & column 7 from a CSV Format file & then i have to find the difference between these columns as these both columns contains date & time in 7/7/2012 9:20 this format . So kindly help me out ASAP. But please kindly dis xls has to be converted in csv format as may... (5 Replies)
Discussion started by: Prateek@123
5 Replies

7. Shell Programming and Scripting

Perl regexp to extract first and second column

Hi, I am trying with the below Perl one-liner using regular expression to extract the first and second column of a text file: perl -p -e "s/\s*(\w+).*/$1/" perl -p -e "s/\s*.+\s(.+)\s*/$1\n/" whereas the text file's data looks like: Error: terminated 2233 Warning: reboot 3434 Warning:... (3 Replies)
Discussion started by: royalibrahim
3 Replies

8. Shell Programming and Scripting

Perl - Extract first column from file

Hi, I want to extract first column from a file and redirect the output to another file in perl. I am able to do this from command line by executing below commands. perl -anle 'print $F' Input.dat > Output.dat perl -ne '@F = split("\t", $_); print "$F\n";' Input.dat > Output.dat perl -anE... (7 Replies)
Discussion started by: Neethu
7 Replies

9. Shell Programming and Scripting

Compare 2 files of csv file and match column data and create a new csv file of them

Hi, I am newbie in shell script. I need your help to solve my problem. Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file. File1: SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
Discussion started by: refrain
8 Replies

10. UNIX for Beginners Questions & Answers

How do I extract specific column in multiple csv files?

file1: Name,Threshold,Curr Samples,Curr Error%,Curr ART GETHome,100,21601,0.00%,47 GETregistry,100,21592,0.00%,13 GEThomeLayout,100,30466,0.00%,17 file2: Name,Threshold,Curr Samples,Curr Error%,Curr ART GETHome,100,21601,0.00%,33 GETregistry,100,21592,0.00%,22... (6 Replies)
Discussion started by: Raghuram717
6 Replies
Bio::Index::Fastq(3pm)					User Contributed Perl Documentation				    Bio::Index::Fastq(3pm)

NAME
Bio::Index::Fastq - Interface for indexing (multiple) fastq files SYNOPSIS
# Complete code for making an index for several # fastq files use Bio::Index::Fastq; use strict; my $Index_File_Name = shift; my $inx = Bio::Index::Fastq->new( '-filename' => $Index_File_Name, '-write_flag' => 1); $inx->make_index(@ARGV); # Print out several sequences present in the index # in Fastq format use Bio::Index::Fastq; use strict; my $Index_File_Name = shift; my $inx = Bio::Index::Fastq->new('-filename' => $Index_File_Name); my $out = Bio::SeqIO->new('-format' => 'Fastq','-fh' => *STDOUT); foreach my $id (@ARGV) { my $seq = $inx->fetch($id); # Returns Bio::Seq::Quality object $out->write_seq($seq); } # or, alternatively my $id; my $seq = $inx->get_Seq_by_id($id); #identical to fetch DESCRIPTION
Inherits functions for managing dbm files from Bio::Index::Abstract.pm, and provides the basic funtionallity for indexing fastq files, and retrieving the sequence from them. Note: for best results 'use strict'. Bio::Index::Fastq supports the Bio::DB::BioSeqI interface, meaning it can be used as a Sequence database for other parts of bioperl FEED_BACK Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Support Please direct usage questions or support issues to the mailing list: bioperl-l@bioperl.org rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Tony Cox Email - avc@sanger.ac.uk APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ _file_format Title : _file_format Function: The file format for this package, which is needed by the SeqIO system when reading the sequence. Returns : 'Fastq' _index_file Title : _index_file Usage : $index->_index_file( $file_name, $i ) Function: Specialist function to index FASTQ format files. Is provided with a filename and an integer by make_index in its SUPER class. Example : Returns : Args : id_parser Title : id_parser Usage : $index->id_parser( CODE ) Function: Stores or returns the code used by record_id to parse the ID for record from a string. Useful for (for instance) specifying a different parser for different flavours of FASTQ file. Returns &default_id_parser (see below) if not set. If you supply your own id_parser subroutine, then it should expect a fastq description line. An entry will be added to the index for each string in the list returned. Example : $index->id_parser( &my_id_parser ) Returns : ref to CODE if called without arguments Args : CODE default_id_parser Title : default_id_parser Usage : $id = default_id_parser( $header ) Function: The default Fastq ID parser for Fastq.pm Returns $1 from applying the regexp /^>s*(S+)/ to $header. Returns : ID string Args : a fastq header line string perl v5.14.2 2012-03-02 Bio::Index::Fastq(3pm)
All times are GMT -4. The time now is 02:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy