LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to comment multiple statement? (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-comment-multiple-statement-4175442253/)

johnabraham 12-19-2012 11:51 PM

how to comment multiple statement?
 
Hi

I want to comment multiple lines in any config file, how can i do it? is there any solution?

thanks

chrism01 12-20-2012 12:11 AM

What does the cfg file look like? What syntax does it use for commenting? Is this in eg vi/vim, or do you need a programmatic soln eg sed?

johnabraham 12-20-2012 04:24 AM

i want to comment multiple lines in DHCP config file. as we comment multiple lines by /* */ in c.

malekmustaq 12-20-2012 05:33 AM

Quote:

Originally Posted by johnabraham (Post 4853557)
i want to comment multiple lines in DHCP config file. as we comment multiple lines by /* */ in c.

/* this is comment in C */

# this is comment in unix scripts running in bash or csh #

They call it # pound # that's what we use to comment on most Gnu/Linux/*nix config files as they are found in /etc directory; and since it is line oriented one comment at the beginning of the line is good until the end.

Example:

# if [ "$1" = "stop" ]; then
# echo "Stopping gpm..."
# /usr/sbin/gpm -k
elif [ "$1" = "restart" ]; then
echo "Restarting gpm..."

The 'if', 'echo' and '/usr...' lines are commented and not read; the elif is read and subsequent.

Hope that helps.

Good luck.

David the H. 12-20-2012 07:27 AM

I suggest you first do a search or two of past archives and/or the web and see how other people have handled the same kind of problem. Also, sed is the most common tool for this kind of job, so try looking up how to use it.

Second, we're not here to do your jobs for you, but we will help you if you have specific problems. Show us what you have attempted on your own, and we'll be happy to guide you through your problem areas.

Finally, and more generally, if you want clear answers you have to provide clear questions. Explaining your situation and environment in detail and providing a representative example of the text you have, and how you want it to look afterwards, will help us understand the problem as you see it, and give you the most useful advice possible.


All times are GMT -5. The time now is 06:25 PM.