Data processing
Frequently Asked Questions
How to find all unique words in a file?
Use the grep command with a regular expression and filter out the words, followed by a sort and making them unique.
How to remove trailing whitespace from a file?
Run the sed command to trim any trailing whitespace.
sed -i 's/[[:space:]]*$//' FILE
How to insert a line at the beginning of a file?
Use the sed command and let it perform an inline replacement.
sed -i '1i # New first line' FILE