#!/usr/bin/perl $keyword = shift @ARGV; $line = 0; while(<>) { $line++; chop; print "[$line] ", $_ , "\n" if(/$keyword/) }