Walk the line…endings

Have a file where you want to add a comma to the end of each line? $ sed ‘s/$/,/’ ip_addresses.txt | head -n2 This should work…but, wait, it didn’t. Instead, it replaced the first character of each line with a comma: ,6.127.0.0/17 ,7.238.80.0/21 Ah, because the file is dos encoded, see the “\r \n”: $ […]