in reply to To get file names from the search string
grep -il "^$input" *
is equivalent to the following Perl one-liner in bash:
perl -lne '$seen{$ARGV} = 1 if /^'"$input/i }{ print for keys %seen" *
or the following script:
#!/usr/bin/perl use strict; use warnings; my $input = shift; for my $file (glob '*') { open my $IN, '<', $file or die $!; while (<$IN>) { if (/^$input/i) { print "$file\n"; last; } } }
Run as script.pl "$input".
|
|---|