The file is formatted like this
The problem that is the hardest to solve
The crux shadows
Addendum for those who submit combos
Half asleep and crabby
I’m groggy still
Being half asleep and crabby
(the number doesnt matter really, because that can be added in later)
And I need to get it like this
crux, The problem that is the hardest to solve, The crux shadows
addendum, an addition, Addendum...
so basically it can be read into excel as a csv file.
So far I have it like this:
The problem that is the hardest to solve,
The crux shadows,
Addendum for those who submit combos,
Half asleep and crabby,
I’m groggy still,
(those are commas at the ends of the lines, although they look like periods/full stops)
so basically i need to join up all lines with a comma at the end... any ideas??
My script reads like this so far:
cat words.txt |
sed 's/$/\,/g' | #adds commas to end of each line
tr -d '1''2''3''4''5''6''7''8''9''0' | #removes all numbers
sed 'n;n;G;' > words.csv #adds a new line every forth line
#sed -e :a -e '/\\$/N; s/\\\n//; ta' #should join up all lines with BACKSLASHES at the end
How can I modify the last line to make it join up lines ending in the commas?