Skip to main content
edited body
Source Link
Kusalananda
  • 356.2k
  • 42
  • 737
  • 1.1k
mysql ... | awk '{ print "diff is", $0 }'

Or just

mysql ... 'SELECT CONCAT("diff is ", VALUE) FROM ...'

From within awk:

awk 'BEGIN { cmd = "mysql ..." }
     { cmd | getline value;
       printf("diff is %d\n"%s\n", value); # or print "diff is", value;
       close(cmd) }'

This will run the command once for each line of input to the awk script. Without the close(), it would be run once and give value the value of each successive output line of the command.

Your script uses $lastdiff rather than lastdiff with getline. In awk, $lastdiff refers to field number lastdiff of the current input record.

mysql ... | awk '{ print "diff is", $0 }'

Or just

mysql ... 'SELECT CONCAT("diff is ", VALUE) FROM ...'

From within awk:

awk 'BEGIN { cmd = "mysql ..." }
     { cmd | getline value;
       printf("diff is %d\n", value); # or print "diff is", value;
       close(cmd) }'

This will run the command once for each line of input to the awk script. Without the close(), it would be run once and give value the value of each successive output line of the command.

Your script uses $lastdiff rather than lastdiff with getline. In awk, $lastdiff refers to field number lastdiff of the current input record.

mysql ... | awk '{ print "diff is", $0 }'

Or just

mysql ... 'SELECT CONCAT("diff is ", VALUE) FROM ...'

From within awk:

awk 'BEGIN { cmd = "mysql ..." }
     { cmd | getline value;
       printf("diff is %s\n", value); # or print "diff is", value;
       close(cmd) }'

This will run the command once for each line of input to the awk script. Without the close(), it would be run once and give value the value of each successive output line of the command.

Your script uses $lastdiff rather than lastdiff with getline. In awk, $lastdiff refers to field number lastdiff of the current input record.

added 240 characters in body
Source Link
Kusalananda
  • 356.2k
  • 42
  • 737
  • 1.1k
mysql ... | awk '{ print "diff is", $0 }'

Or just

mysql ... 'SELECT CONCAT("diff is ", VALUE) FROM ...'

From within awk:

awk 'BEGIN { cmd = "mysql ..." }
     { cmd | getline value;
       printf("diff is %d\n", value); # or print "diff is", value;
       close(cmd) }'

This will run the command once for each line of input teto the awk script. Without the close(), it would be run once and give value the value of each successive output line of the command.

Your script uses $lastdiff rather than lastdiff with getline. In awk, $lastdiff refers to field number lastdiff of the current input record.

mysql ... | awk '{ print "diff is", $0 }'

Or just

mysql ... 'SELECT CONCAT("diff is ", VALUE) FROM ...'

From within awk:

awk 'BEGIN { cmd = "mysql ..." }
     { cmd | getline value;
       printf("diff is %d\n", value); # or print "diff is", value;
       close(cmd) }'

This will run the command once for each line of input te the awk script. Without the close(), it would be run once and give value the value of each successive output line of the command.

Your script uses $lastdiff rather than lastdiff with getline. In awk, $lastdiff refers to field number lastdiff of the current input record.

mysql ... | awk '{ print "diff is", $0 }'

Or just

mysql ... 'SELECT CONCAT("diff is ", VALUE) FROM ...'

From within awk:

awk 'BEGIN { cmd = "mysql ..." }
     { cmd | getline value;
       printf("diff is %d\n", value); # or print "diff is", value;
       close(cmd) }'

This will run the command once for each line of input to the awk script. Without the close(), it would be run once and give value the value of each successive output line of the command.

Your script uses $lastdiff rather than lastdiff with getline. In awk, $lastdiff refers to field number lastdiff of the current input record.

added 240 characters in body
Source Link
Kusalananda
  • 356.2k
  • 42
  • 737
  • 1.1k
mysql ... | awk '{ print "diff is", $0 }'

Or just

mysql ... 'SELECT CONCAT("diff is ", VALUE) FROM ...'

From within awk:

awk 'BEGIN { cmd = "mysql ..." }
     { cmd | getline value;
       printf("diff is %d\n", value); # or print "diff is", value;
       close(cmd) }'

This will run the command once for each line of input te the awk script. Without the close(), it would be run once and give value the value of each successive output line of the command.

Your script uses $lastdiff rather than lastdiff with getline. In awk, $lastdiff refers to field number lastdiff of the current input record.

mysql ... | awk '{ print "diff is", $0 }'

Or just

mysql ... 'SELECT CONCAT("diff is ", VALUE) FROM ...'
mysql ... | awk '{ print "diff is", $0 }'

Or just

mysql ... 'SELECT CONCAT("diff is ", VALUE) FROM ...'

From within awk:

awk 'BEGIN { cmd = "mysql ..." }
     { cmd | getline value;
       printf("diff is %d\n", value); # or print "diff is", value;
       close(cmd) }'

This will run the command once for each line of input te the awk script. Without the close(), it would be run once and give value the value of each successive output line of the command.

Your script uses $lastdiff rather than lastdiff with getline. In awk, $lastdiff refers to field number lastdiff of the current input record.

Source Link
Kusalananda
  • 356.2k
  • 42
  • 737
  • 1.1k
Loading