extract characters between two commas?
Since cut
prints non-delimited lines by default the following works
cut -f2 -d, file
awk -F, 'NF > 1 { $1 = $2 } { print $1 }' file
This uses awk
to parse the file as lines consisting of comma-delimited fields.
The code detects when there is more than a single field on a line, and when there is, the first field is replaced by the second field. The first field, either unmodified or modified by the conditional code, is then printed.