#!/usr/bin/perl use strict; use warnings; my $infile = '/path/to/source.txt'; my $outfile = '/other/path/to/outfile.txt'; # welche Spalten sind gewünscht? (Hier: die 2., 5., 8., 9., 10.) # Achtung: Es ist jeweils der Index - beginnt also bei 0 (wie bei Arrays) my @wanted = qw(1 4 7 8 9); open my $in,'<',$infile or die $!; open my $out,'>',$outfile or die $!; while(my $line = <$in>){ chomp $line; my @cols = split /,/$line; print $out join("\t",@cols[@wanted]),"\n"; } close $out; close $in;