- sed reads a stream line by line and prints the result; only the
-ioption changes the file, and-i.bakkeeps a copy to roll back to. - The
/^backend=/address limits the replacement to the lines you need; like in grep, the replacement pattern is searched for anywhere in the line. - awk splits a line into fields
$1,$2…;-Fsets the separator, andENDprints the total after the last line. - The array
s[$2] += $3adds up a total for every value of a field, and a condition before the action picks the lines. - At the start of the lesson, sed without an address changed the rollback line too and wrote nothing to the file: the replacement lacked a line address, and the write lacked the
-ioption.
Step 9 of 9 · summary · 2 min
Summary
Found an inaccuracy? Report an error in the lesson