Originally Posted by sleeper0110
Can someone explaine why the second line I posted doesn't work but the first one does?
Because \n is the Record Separator in awk and it is not taken in account in $0. Hence the pattern \r\n is not found, whereas \r is the last character in the string. Anyway, I second ghostdog: don't reinvent the wheel and try dos2unix, instead.