ravi45722 has asked for the wisdom of the Perl Monks concerning the following question:
Here I am trying to get a value. My code is like this
cut -d "|" -f 1,10,13 SMSCDR*$date$hour$minute*.log |grep "Submit|SMPP" |grep "$hour:$min:$sec" |sort |uniq -c`foreach my $min (20 .. 29) { foreach my $sec (@seconds) { my $SMPP_count = split (/[\s]/,(chomp(`cut -d "|" -f 1 +,10,13 SMSCDR*$date$hour$minute*.log |grep "Submit|SMPP" |grep "$hour +:$min:$sec" |sort |uniq -c`)))[0]; print $SMPP_count; } }
I will return
20 Wed Sep 23 06:20:02 2015|Submit|SMPPIn this statement a new line is presented in the last. to remove that I am using chomp. For getting the value I am using split with "\s" (space separator). But its showing error.
Can't modify quoted execution (``, qx) in chomp at second.pl line 24, +near "`cut -d "|" -f 1,10,13 SMSCDR*$date$hour$minute*.log |grep "Sub +mit|SMPP" |grep "$hour:$min:$sec" |sort |uniq -c`)" syntax error at second.pl line 24, near ")[" Global symbol "$SMPP_count" requires explicit package name at second.p +l line 25. Execution of second.pl aborted due to compilation errors.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using system command in regex
by AppleFritter (Vicar) on Oct 13, 2015 at 10:06 UTC | |
by ravi45722 (Pilgrim) on Oct 13, 2015 at 11:15 UTC | |
by shmem (Chancellor) on Oct 13, 2015 at 12:34 UTC | |
by ravi45722 (Pilgrim) on Oct 14, 2015 at 05:46 UTC | |
by shmem (Chancellor) on Oct 15, 2015 at 07:51 UTC | |
| |
by shmem (Chancellor) on Oct 14, 2015 at 17:48 UTC | |
| |
by AppleFritter (Vicar) on Oct 13, 2015 at 12:07 UTC | |
by ravi45722 (Pilgrim) on Oct 13, 2015 at 13:09 UTC |