I want to Modify few lines of a file under a folder .. From Line number 45 to Line number 47... Enter Lines.
How to do it ?
Sorry , if question has BIG scope of answer !!!
Shell script
Re: Shell script
Your question is not CentOS specific.
It is not exactly clear to me what you do want to do.
info sed
sed -e '45 s/$/\n\n\n/'
It is not exactly clear to me what you do want to do.
info sed
sed -e '45 s/$/\n\n\n/'
Re: Shell script
For Example :
I want to modify through shell script..
elif [[ "$redhat_release" =~ "CentOS" ]]; then
[ "$BOOTUP" = "color" ] && echo -en "\\033[0;33m"
PRODUCT=`sed "s/CentOS \(.*\) release.*/\1/" /etc/centos-release`
echo -e " $PRODUCT"
[ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m"
TO
elif [[ "$redhat_release" =~ "EasyDialNOW" ]]; then
[ "$BOOTUP" = "color" ] && echo -en "\\033[0;33m"
PRODUCT=`sed "s/CentOS \(.*\) release.*/\1/" /etc/centos-release`
echo -e " $PRODUCT"
[ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m"
I want to modify through shell script..
elif [[ "$redhat_release" =~ "CentOS" ]]; then
[ "$BOOTUP" = "color" ] && echo -en "\\033[0;33m"
PRODUCT=`sed "s/CentOS \(.*\) release.*/\1/" /etc/centos-release`
echo -e " $PRODUCT"
[ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m"
TO
elif [[ "$redhat_release" =~ "EasyDialNOW" ]]; then
[ "$BOOTUP" = "color" ] && echo -en "\\033[0;33m"
PRODUCT=`sed "s/CentOS \(.*\) release.*/\1/" /etc/centos-release`
echo -e " $PRODUCT"
[ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m"
Re: Shell script
There are many answers to your question, here are just the ones i thought first:
- If you use only console and like interactivity, try vi, vim, nano or emacs
- If you use console but dislike interactivity, try sed, awk
- If you use only graphical mode, try gvim, gedit, kate, kwrite, xemacs, jedit...
Regards.
P.S: Next time try googling for "linux text editor"
- If you use only console and like interactivity, try vi, vim, nano or emacs
- If you use console but dislike interactivity, try sed, awk
- If you use only graphical mode, try gvim, gedit, kate, kwrite, xemacs, jedit...
Regards.
P.S: Next time try googling for "linux text editor"
-
- Retired Moderator
- Posts: 18276
- Joined: 2006/12/13 20:15:34
- Location: Tidewater, Virginia, North America
- Contact:
Shell script
Moving to Social as there is no CentOS question here. If you have more specific questions, please ask away.