Work with text files
The post describes basic tricks to deal with text files in Linux.
It's useful when you process large lists of records.
Concatenate files and keep the new line at the end of each file:
sed '$a\' input_files* > output_file
Check the number of unique lines in a file:
uniq -u file_name | wc -l
Change the format of the new line:
Linux to Windows
unix2dos
Windows to Linux
dos2unix
Or in case of permission issues with the temporary file:
dos2unix -n test_file tmp_file
mv -f tmp_file test_file
Some additional info is available here:
https://access.redhat.com/solutions/3168671