Reputation: 80
I have several thousand large text files that I need to clean up. I need any line that ends with a comma to end with a comma followed by a period (,.).
I found the following, which works for every line except the last line. It must be close to what I need but I can't figure out how to make it work on the last line as well.
find . -name "*.txt" -print | xargs sed -i ':a;N;$!ba;s/,\n/,\.\n/g'
My data looks something like this:
0,0,0,193,17,.,.,
0,0,0,174,19,.,.,
0,0,0,124,14,.,.,
I need it to look like this:
0,0,0,193,17,.,.,.
0,0,0,174,19,.,.,.
0,0,0,124,14,.,.,.
Upvotes: 1
Views: 215