using sed in bash scripts
# Inserting a text on a specified line number ex. insert a text in line number 8 sed command “8i”
-e '8i\# PC-Check 7\.03 with net support'
special characters like # and . should have a \ suffix.
# Insert a blank line on line number
-e '8i\\`echo -e '\n\r'`'
# to append at end of the file: sed command: $a
-e '\$a#HQ to local DVR'
# search and replace, ^ - match all words beginning the word specified and replace the matching word,
-e 's/^DNAT/#DNAT/g'
# search and replace whole line: .* - match all lines containing the word being search and replace the whole line.
-e 's/.*DNAT.*/#DNAT/g'
No comment
Say something
Thank you
Your post has been submitted and will be published once it has been approved.
OK
OOPS!
Your post has not been submitted. Please return to the page and try again. Thank You!
If this error persists, please open an issue by clicking here.
OK