awk '{ printf $0", " }'
This is awk command with single action, encased in {
...}
, this action is applied to every line of input.
Printf is print with format, here no formatting takes places but another feature of printf
is leveraged - printf
does not attach output row separator (default: newline) as opposed to print
.
$0
denotes whole current line (sans trailing newline).
", "
is string literal for comma followed by space.
$0", "
instructs awk to concatenate current line with comma and space.
Whole command thus might be read as: for every line output current line followed by comma and space
sed 's/.\{2\}$/./'
s
is one of commands, namely substitute, basic form is
s/regexp/replacement/
therefore
.\{2\}$
is regular expression, .
denotes any characters, \{2\}
repeated 2 times, $
denotes end of line, thus this one matches 2 last characters of each line, as text was already converted to single line, it will match 2 last characters of whole text.
.
is replacement, literal dot character
Whole command thus might be read as: for every line replace 2 last characters using dot