[root@]# cat a.txt
94,aqqc,62345907,
5,aeec,77,
[root@]# cat 1.pl
#!/usr/bin/perl
use strict;
use warnings;
use Date::Manip;
open(my $FA, "/root/a.txt") or die "$!";
while(<$FA>) {
chomp;
my @tmp=split(/\,/, $_);
if (index($tmp[1], "qq") ne -1) {
print "$_\n";
}
}
close ($FA);
[root@]# perl 1.pl
94,aqqc,62345907,
As we can see, if i want to print out this a.txt, but without the line field 1 value contains "qq", i can use open the file method.
Wonderring if there is any more simple way to do that, more efficient one, image i have 1000lines for the a.txt?