Skip to content

mariojsantos/oneLiners

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

oneLiners

Useful things (for me, at some point) that can be done in one line using shell script

  1. Comment out all lines of a text file and writes the command output in a new text file;

sed -E '/^[[:space:]]*(#|$)/! s/^/#/' [file] >> [newfile]

  1. Do the same thing as the previous command, however, overwrites the original file with the changes. Use this form very carefully!

sed -iE '/^[[:space:]]*(#|$)/! s/^/#/' [file]

  1. The following command allows define a line range to comment out and sends the output to a new text file.

sed -nE -e 'startline,endline p' [file] | sed -E '/^[[:space:]]*(#|$)/! s/^/#/' >> [newfile]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published