How do I add a new line at the beginning of every file in /home/johnny containing the text "Hello", followed by a blank line? Also, I have to delete every useless space or tab at the ending of every line(if a line contains only spaces or tabs, they will be deleted, but the line must be kept).
Try the following (started in
The results are displayed on the standard output.
Finally a simple redirection creates the
It works on files with spaces in their names, because
If you do not want to keep the original files, modify the command as follows:
The main addition is a move command that replaces the original files with the modified version.