Search and replace text in a file with ed.

I have a text file containing this string. deusexmachina:Documents jason$ cat out Darwin deusexmachina.local 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64deusexmachina:Documents jason$ cat out Darwin deusexmachina.local 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64 And I want to replace one instance of the word … Read more

How to replace spaces in file or directory names with hyphens or underscores with the Linux shell.

This command will take all files and directories in a folder and replace all of the spaces in their names with hyphens. This could be a very useful command when you want the files to have sensible filenames. john@adeptus-mechanicus ~ $ ls -hula | perl -e ‘rename $_, s/\s+/-/gr for (<*>)’john@adeptus-mechanicus ~ $ ls -hula … Read more