Link to this headingSED
https://github.com/adrianscheff/useful-sed
https://github.com/chmln/sd easier sed
Link to this headingReplace
Replace Line in file that matches:
#Uncomment matched line
#Comment matched line
Link to this headingRemove
Remove the 1st line:
Remove the first 100 lines (remove line 1-100):
Remove lines with string (e.g. ‘bbo’):
# case insensitive:
Remove lines whose nth character not equal to a value (e.g. 5th character not equal to 2):
#aaaa2aaa (you can stay)
#aaaa1aaa (delete!)
Remove empty lines:
Delete/remove last line:
Link to this headingAdd
Add string to beginning of file (e.g. “[”):
Add string at certain line number (e.g. add ‘something’ to line 1 and line 3):
Add string to beginning of every line (e.g. ‘bbo’):
Link to this headingPrint Lines
Print a number of lines (e.g. line 10th to line 33 rd):