#!/bin/perl -w use strict; #for a csv file you can try something like this, #but there are dozens of ways to do this. #you should read a book called "Sam's learn perl in #24 hours" (or similar title). #variables you can change to suit your needs my $column_separator = ","; my $column_number = "3"; $column_number--; my $file="filename.ext"; open(FILE,"<","$file"); my @lines=<FILE>; close FILE; foreach my $line (@lines){ my @columns = split(/$column_separator/,"$line"); print $columns[$column_number],"\n"; }
In reply to Re: extracting single column
by gg48gg
in thread extracting single column
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |