Replace Characters in txt file
I have txt file with list of ID's and I need to insert comma in every line and then remove new line character so it'll become one long string.
So to clarify, I have txt file content that looks like this.
... and so on.
but I would like this to change to 234,5466,2356,...
I looked at sed and tried to wrap my head around the commands but I guess my brain isn't smart enough. its really confusing for me.
I've managed to add commas to end of line (sed "s/$/,/g" filename) but somehow I can't seem to remove new line character from each line.
sed 's/[ \n]*$//' doesn't seem to work. can anyone tell me what I'm doing wrong?
Last edited by struct; 11-07-2010 at 01:00 PM.