Skip to main content
deleted 23 characters in body
Source Link
Stéphane Chazelas
  • 587.9k
  • 96
  • 1.1k
  • 1.7k

If logread -t adds a [123456789.123] additional epoch second timestamp after the ctime() one as its code suggests, you should be able to do it with just busybox awk:

logread -t | awk ' BEGIN {lastminute = srand(srand()) - 60} match($0, /\[[0-9.]+\]/) && substr($0, RSTART+1, RLENGTH-2) > lastminute { print substr($0, 1, RSTART - 32) substr($0, RSTART+RLENGTH) }' 

srand(seed) seeds the PRNG and returns the previous seed. When not passed a seed, it uses the current epoch seconds, so srand(srand()) returns the current epoch seconds.

Then we look for [digits-and-dots], remove it and print if digits-and-dots extracted from it are after lastminute.

If logread -t adds a [123456789.123] additional epoch second timestamp after the ctime() one as its code suggests, you should be able to do it with just busybox awk:

logread -t | awk ' BEGIN {lastminute = srand(srand()) - 60} match($0, /\[[0-9.]+\]/) && substr($0, RSTART+1, RLENGTH-2) > lastminute { print substr($0, 1, RSTART - 3) substr($0, RSTART+RLENGTH) }' 

srand(seed) seeds the PRNG and returns the previous seed. When not passed a seed, it uses the current epoch seconds, so srand(srand()) returns the current epoch seconds.

Then we look for [digits-and-dots], remove it and print if digits-and-dots extracted from it are after lastminute.

If logread -t adds a [123456789.123] additional epoch second timestamp after the ctime() one as its code suggests, you should be able to do it with just busybox awk:

logread -t | awk ' BEGIN {lastminute = srand(srand()) - 60} match($0, /\[[0-9.]+\]/) && substr($0, RSTART+1, RLENGTH-2) > lastminute { print substr($0, 1, RSTART-2) substr($0, RSTART+RLENGTH) }' 

srand(seed) seeds the PRNG and returns the previous seed. When not passed a seed, it uses the current epoch seconds, so srand(srand()) returns the current epoch seconds.

Then we look for [digits-and-dots], remove it and print if digits-and-dots extracted from it are after lastminute.

deleted 23 characters in body
Source Link
Stéphane Chazelas
  • 587.9k
  • 96
  • 1.1k
  • 1.7k

If logread -t adds a [123456789.123] additional epoch second timestamp after the ctime() one as its code suggests, you should be able to do it with just busybox awk:

logread -t | awk ' BEGIN {lastminute = srand(srand()) - 60} match($0, /\[[0-9.]+\]/) { t =&& substr($0, RSTART+1, RLENGTH-2)   > lastminute {  $0 = print substr($0, 1, RSTART - 3) substr($0, RSTART+RLENGTH)   if (t > lastminute) print }' 

srand(seed) seeds the PRNG and returns the previous seed. When not passed a seed, it uses the current epoch seconds, so srand(srand()) returns the current epoch seconds.

Then we look for [digits-and-dots], remove it after having extracted theand print if digits-and-dots extracted from it and print the modified record ifare after lastminute.

If logread -t adds a [123456789.123] additional epoch second timestamp after the ctime() one as its code suggests, you should be able to do it with just busybox awk:

logread -t | awk ' BEGIN {lastminute = srand(srand()) - 60} match($0, /\[[0-9.]+\]/) { t = substr($0, RSTART+1, RLENGTH-2)   $0 = substr($0, 1, RSTART - 3) substr($0, RSTART+RLENGTH)   if (t > lastminute) print }' 

srand(seed) seeds the PRNG and returns the previous seed. When not passed a seed, it uses the current epoch seconds, so srand(srand()) returns the current epoch seconds.

Then we look for [digits-and-dots], remove it after having extracted the digits-and-dots from it and print the modified record if after lastminute.

If logread -t adds a [123456789.123] additional epoch second timestamp after the ctime() one as its code suggests, you should be able to do it with just busybox awk:

logread -t | awk ' BEGIN {lastminute = srand(srand()) - 60} match($0, /\[[0-9.]+\]/) && substr($0, RSTART+1, RLENGTH-2) > lastminute {   print substr($0, 1, RSTART - 3) substr($0, RSTART+RLENGTH) }' 

srand(seed) seeds the PRNG and returns the previous seed. When not passed a seed, it uses the current epoch seconds, so srand(srand()) returns the current epoch seconds.

Then we look for [digits-and-dots], remove it and print if digits-and-dots extracted from it are after lastminute.

edited body
Source Link
Stéphane Chazelas
  • 587.9k
  • 96
  • 1.1k
  • 1.7k

If logread -t adds a [123456789.123] additional epoch secondadditional epoch second timestamp after the ctime() one as its code suggests, you should be able to do it with just busybox awk:

logread -t | awk ' BEGIN {lastminute = srand(srand()) - 60} match($0, /\[[0-9.]+\]/) { t = substr($0, RSTART+1, RLENGTH-12) $0 = substr($0, 1, RSTART - 3) substr($0, RSTART+RLENGTH) if (t > lastminute) print }' 

srand(seed) seeds the PRNG and returns the previous seed. When not passed a seed, it uses the current epoch seconds, so srand(srand()) returns the current epoch seconds.

Then we look for [digits-and-dots], remove it after having extracted the digits-and-dots from it and print the modified record if after lastminute.

If logread -t adds a [123456789.123] additional epoch second timestamp, you should be able to do it with just busybox awk:

logread -t | awk ' BEGIN {lastminute = srand(srand()) - 60} match($0, /\[[0-9.]+\]/) { t = substr($0, RSTART+1, RLENGTH-1) $0 = substr($0, 1, RSTART - 3) substr($0, RSTART+RLENGTH) if (t > lastminute) print }' 

srand(seed) seeds the PRNG and returns the previous seed. When not passed a seed, it uses the current epoch seconds, so srand(srand()) returns the current epoch seconds.

Then we look for [digits-and-dots], remove it after having extracted the digits-and-dots from it and print the modified record if after lastminute.

If logread -t adds a [123456789.123] additional epoch second timestamp after the ctime() one as its code suggests, you should be able to do it with just busybox awk:

logread -t | awk ' BEGIN {lastminute = srand(srand()) - 60} match($0, /\[[0-9.]+\]/) { t = substr($0, RSTART+1, RLENGTH-2) $0 = substr($0, 1, RSTART - 3) substr($0, RSTART+RLENGTH) if (t > lastminute) print }' 

srand(seed) seeds the PRNG and returns the previous seed. When not passed a seed, it uses the current epoch seconds, so srand(srand()) returns the current epoch seconds.

Then we look for [digits-and-dots], remove it after having extracted the digits-and-dots from it and print the modified record if after lastminute.

Source Link
Stéphane Chazelas
  • 587.9k
  • 96
  • 1.1k
  • 1.7k
Loading