bad idea
@vaporeon_ s/\S+/,/g
@vaporeon_ ah fuck capital s is not whitespace? that always trips me up
@monorail @vaporeon_ extended POSIX has [:space:]
@aescling @monorail @vaporeon_ the extended POSIX square bracket shit pisses me off for no reason
@wallhackio @aescling @monorail @vaporeon_ are whitespace separated values not the default for awk????
@Lady @wallhackio @aescling @monorail Did you read the thread? Yes, values are separated by whitespace in AWK, but it doesn't handle quoting. "foo bar" would be treated as two fields "foo and bar". That's the whole problem.
@vaporeon_ @wallhackio @aescling @monorail ah yes, i see now
you can solve this in sed but it isn’t pretty
@vaporeon_ @wallhackio @aescling @monorail i was thinking something like this (untested; may not work)
x;s/.*//;x
:outside
/^[^ ]*"/{
s/"/"\n/
H
x;s/[^\n]*$//;x
s/.*\n//
b inside
}
/ /{
s/ /,\n/
H
x;s/[^\n]*$//;x
s/.*\n//
b outside
}
b done
:inside
/^[^ ]*"/{
s/"/"\n/
H
x;s/[^\n]*$//;x
s/.*\n//
b outside
}
/ /{
s/ / \n/
H
x;s/[^\n]*$//;x
s/.*\n//
b inside
}
b done
:done
H
x
s/\n//
(note that this does not handle unquoted commas which may need to be quoted)
(can you solve this with a single regex? maybe??? but i was thinking of just writing a parser)