How to convert the second column to the following format, there are only two cases:
a.if the last five character is a hyphen plus four numeric digit, keep the the last five digits before the hypen as well as everything after hyphen (including hyphen).
b. if the last five character doesn't contain a hyphen, keep the last five digits.
so the output.csv is:
Fort, 34440-3333
Honda, 89289
Toyota, 23000
Thanks, I guess this will be done in awk but I have no idea how to do it.
wow dan, that's amazing, would you mind explain a bit on how this works?
what is the ? symbol do?
what is the ($2~/-/) do?
what is the }1 in the end do?