in reply to grep lines from log for last 10 mints
interpolation is interpolation, in shell, in awk, in perl -- that is right, you've got three four levels of interpolation in there (quite nuts by my standards)
use strict; use warnings; use Data::Dump; my $line= qq{awk -v start="$(date -d '10 mins ago' +'%b %e %T')" -v e +nd="$(date +'%b %e %T')" '{tm=$1" "$2" "$3}; star t<tm&&tm<end' /d/d1/logs/stdout-1132.txt}; dd $line; __END__ Use of uninitialized value $1 in concatenation (.) or string at - line + 3. Use of uninitialized value $2 in concatenation (.) or string at - line + 3. Use of uninitialized value $3 in concatenation (.) or string at - line + 3. "awk -v start=\"0date -d '10 mins ago' +'%b %e %T')\" -v end=\"0date ++'%b %e %T')\" '{tm=\" \"\" \"}; start<tm&&tm<end' /d/d1/logs/stdout +-1132.txt"
So, not being interested in debugging your shell or awk , I thought I'd just point out the perl errors
Read perlintro and employ some single quotes
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: grep lines from log for last 10 mints
by Anonymous Monk on Aug 06, 2012 at 10:11 UTC | |
by Anonymous Monk on Aug 06, 2012 at 10:30 UTC | |
by bimleshsharma (Beadle) on Aug 06, 2012 at 11:14 UTC | |
by Anonymous Monk on Aug 07, 2012 at 09:22 UTC |