"; local $tailcmd = $config{'tail_cmd'} || "tail -n LINES"; $tailcmd =~ s/LINES/$lines/g; if ($filter ne "") { # Are we supposed to filter anything? Then use grep. local @cats; if ($cmd) { # Getting output from a command push(@cats, $cmd); } elsif ($config{'compressed'}) { # All compressed versions foreach $l (&all_log_files($file)) { $c = &catter_command($l); push(@cats, $c) if ($c); } } else { # Just the one log @cats = ( "cat ".quotemeta($file) ); } $cat = "(".join(" ; ", @cats).")"; if ($config{'reverse'}) { $tailcmd .= " | tac"; } $eflag = $gconfig{'os_type'} =~ /-linux/ ? "-E" : ""; $dashflag = $gconfig{'os_type'} =~ /-linux/ ? "--" : ""; if (@cats) { $got = &proc::safe_process_exec( "$cat | grep -i -a $eflag $dashflag $filter ". "| $tailcmd", 0, 0, STDOUT, undef, 1, 0, undef, 1); } else { $got = undef; } } else { # Not filtering .. so cat the most recent non-empty file if ($cmd) { # Getting output from a command $fullcmd = $cmd." | ".$tailcmd; } elsif ($config{'compressed'}) { # Cat all compressed files local @cats; $total = 0; foreach $l (reverse(&all_log_files($file))) { next if (!-s $l); $c = &catter_command($l); if ($c) { $len = int(&backquote_command( "$c | wc -l")); $total += $len; push(@cats, $c); last if ($total > $in{'lines'}); } } if (@cats) { $cat = "(".join(" ; ", reverse(@cats)).")"; $fullcmd = $cat." | ".$tailcmd; } else { $fullcmd = undef; } } else { # Just run tail on the file $fullcmd = $tailcmd." ".quotemeta($file); } if ($config{'reverse'} && $fullcmd) { $fullcmd .= " | tac"; } if ($fullcmd) { $got = &proc::safe_process_exec( $fullcmd, 0, 0, STDOUT, undef, 1, 0, undef, 1); } else { $got = undef; } } print "$text{'view_empty'}\n" if (!$got); print "