Combining fields in awk
is it easy to combine fields in awk? Specifically, I have lines like this:
1,2,some text
3,4,some text, but it has commas in it, annoyingly
I want to extract two numbers as the first two fields, but then I want all the text (commas and everything) to be the third field. Is there a way to do this?
My main awk call was as follows:
awk -F\, '{print $1"|"$2"|"$3}' file.txt
Which works fine for the first line, but stops at a comma in the text on the second line.
+1
source to share