I have an input file in this form:
foo bar 08 320984 2384 bla foo baz 23 32425 32532 [...] there are always three tokens in the end, but an unknown number of tokens in the front. I want to rewrite the file as CSV so it can be automatically parsed by other applications. my current awk command is:
awk '{ print $(NF-2)";"$(NF-1)";"$NF}' the output should be
foo bar;08;320984;2384 bla foo baz;23;32425;32532 [...]
CSVbut that's not the point. You are trying to split your file into four output fields? Where the last three fields are the last three fields of the input and the first field is everything else on the line?tk1 tk2 tk3 ... tkn TK1 TK2 TK3and has to becometk1 tk2 tk3 ... tkn;TK1;TK2;TK3.;for the last thee fields?