Commit 88244e01 authored by Aleksey Midenkov's avatar Aleksey Midenkov

grep.inc fixes

Wrong comment and unclear error message leads to usage troubles.
parent 179fbeb2
# Grep file for regular expression and output to STDOUT
#
# Usage:
# --let $grep_file= /path/to/your/file
# --let $grep_regex= your_regex_string
# --let grep_file= /path/to/your/file
# --let grep_regex= your_regex_string
# --let grep_once= your_regex_string_to_match_once
# --source include/grep.inc
--perl
open (my $fh, "<", "$ENV{grep_file}") or die $!;
die "grep_file not set!\n" unless $ENV{grep_file};
open (my $fh, "<", "$ENV{grep_file}") or die "$ENV{grep_file}: $!\n";
while (<$fh>)
{
/$ENV{grep_regex}/ &&
if (/$ENV{grep_regex}/) {
print;
} elsif (defined $ENV{grep_once} && /$ENV{grep_once}/) {
print;
last;
}
}
close $fh;
EOF
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment