Yes, my solution was based on different input. Try this:
awk -F "," -v OFS="," '{ x = $(NF-1) " it " $NF; NF -=2; ; print $0, x }'
Creates a new 'token' with the last and next to last tokens placing 'it' in between. Shortens the original input line by two tokens, then prints the short string with the synthetic value in x.
My sed may not always be as terse as the awk from awk gurus, but you might figure out what it does and how it does it more easily. The wild card .* is a greedy spring anchored by the last comma it has to precede. The substring grabber \(\) lets you put the fron of the line back as \1. The end of the line floats after it.
The opposite way is this:
sed 's/,\([^,]*\)$/\1/'
It puts a spring at end of line that captures all not comma characters. This sort of not X wildcard is very useful, as it stops short of the next sort of thing. To me, the charm of sed is the reuse and generality of the tools. I tends to perform faster, too.
Oh, he wanted spaces, well, some enhancements are left to the student! I guess our look and post cycles crossed, so like a pair of bad script processes!
Yes, but sometimes it is so trivial that I skip it. The source gets ugly and the output grows linefeeds or boxes. There, the dot there was a miss for the slash; revisionist history!
---------- Post updated at 09:48 PM ---------- Previous update was at 09:43 PM ----------
I started regex with MULTICS qedx in 1969, often on a printing 300 baud terminal, and then Waterloo Fred under GCOS TSS, before I first saw UNIX in 1990.
Pipes and sed means never having to say "sorry about using all the temp disk space", "the file is too large for my editor" or "please remove your temp file from testing so I can write one", not to mention "what are all these CPUs for?" or "It is not done yet, so I do not know what the output will look like."
Modern sed implementations have no buffer limit, so I have taken whole pages and swapped the line feeds and form feeds back and forth using tr, so I could put pages into insert statements and then into a command line database tool.