recently ran a command ‘sed -i 's/CONFIG_1/CONFIG_OPT_2/g' /etc/nginx/sites-enabled/*.conf
‘ on a Debian Linux server. However, the sed command destroyed the link and created a regular file in place of the link file. How can I prevent my ‘sed -i’ command from destroying symlinks on Linux or Unix-like system?
I‘m using the date +’%D_%T’ to store Unix system date and time in a shell variable called $_now:
I’d like to replace / and : with _. I’m aware of the following sed command:
> s/:/_/g’ <<<"$_now"
How do I specify two pattern within the same sed command to replace | and : with _ so that I can get output as 01_20_12_16_10_42?
Q. How do I perform a case-insensitive search using sed under UNIX / Linux? I’d like to match all combination of word – foo, FOO, FoO and so on while replacing or performing other operations.
Q. How do I remove all digits or number from my text file or input using sed command?
Q. How do I find and replace character codes ( control-codes or nonprintable characters ) such as ctrl+a using sed command under UNIX like operating systems?
need to delete all empty lines but could not figure out sed command for the same. How do I delete all empty lines with sed under Linux or Unix-like systems?