Easy as a one-liner:
perl -lane 'print join ",", map qq("$_"), @F[0, 1]'
-l
handles newlines inprint
-n
reads the input line by line-a
splits each line on whitespace into the@F
array@F[0, 1]
is an array slice, it extracts the first two elements of the@F
arraymap
wraps each element in double quotesjoin
inserts the comma in between
5
solved Perl To Parse Whitespace Separated Columns