Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1,julz,kath,shiela,angel
- 2,may,ann,janice,aika
- 3,christal,justine,kim
- 4,kris,allan,jc,mine
- 3,christal,justine,kim
- perl -ne 'if ($. == 3) {print;exit}' infile.txt
- $ perl -ne'print if $. == 3' your_file.txt
- $ perl -mTie::File -e'tie @lines, q(Tie::File), q(your_file.txt);
- > print $lines[2]'
- perl -ne 'print if 3..3' <infile >outfile
- perl -F, -nae 'print if $F[0] == 3' <infile >outfile # thanks for the comment doh!
- use Tie::File;
- use Fcntl "O_RDONLY";
- tie my @line, "Tie::File", "yourfilename", mode => O_RDONLY
- or die "Couldn't open file: $!";
- print "The third line is ", $line[2];
- open my $fh, '<', 'infile.txt';
- while (my $line = <$fh>) {
- print $line if i_want_this_line($line);
- }
- open $fh, "myfile.txt";
- my @lines = <$fh>;
Add Comment
Please, Sign In to add comment