LINUX (File and Text Utilities) 1) Assume you have a file called \'stuff.dat\'.
ID: 3883761 • Letter: L
Question
LINUX (File and Text Utilities)
1) Assume you have a file called 'stuff.dat'. What command(s) would you use to remove all duplicate lines from the file?
2) You have a Windows formated file called 'notes.txt'. In Windows, newlines are marked with both (linefeed, LF) and (carriage return, CR), while in Unix/Linux/Mac OS X newlines are marked with just (and in older Mac OS versions, newlines are marked with just ). Give the tr command to remove all the characters from the file 'notes.txt'.
3) Give the tr command to replace all tabs in a file called 'stuff.dat' with spaces.
Explanation / Answer
1. The following command removes duplicate froma file.
sort {file-name} | uniq -u
2. To remove " " from file you can use the following command.
3. to replace tabs with spaces:
tr " " " " < {file_name}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.