Shell script

A 5 star hangout for overworked and underpaid system admins.
Post Reply
gmcust3
Posts: 170
Joined: 2009/10/28 19:44:35

Shell script

Post by gmcust3 » 2010/05/12 18:23:02

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 !!!

User avatar
jlehtone
Posts: 4531
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Shell script

Post by jlehtone » 2010/05/12 18:42:23

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/'

gmcust3
Posts: 170
Joined: 2009/10/28 19:44:35

Re: Shell script

Post by gmcust3 » 2010/05/12 19:49:01

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"

skolnick
Posts: 209
Joined: 2007/11/24 16:05:26

Re: Shell script

Post by skolnick » 2010/05/13 01:36:52

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"

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Shell script

Post by pschaff » 2010/05/13 01:39:40

Moving to Social as there is no CentOS question here. If you have more specific questions, please ask away.

Post Reply