From: Tagore on 30 Mar 2010 21:03 hi, I want to comment all lines in a C progamming project with a particular string in it. Which command to do it? Thanks,
From: Ed Morton on 30 Mar 2010 21:13 On 3/30/2010 8:03 PM, Tagore wrote: > hi, > > I want to comment all lines in a C progamming project with a > particular string in it. > > Which command to do it? Probably sed, awk, perl, or ruby. If you provided more information and some sample input and expected output, we could probably help you more. Ed.
From: Tagore on 30 Mar 2010 21:22 > > Probably sed, awk, perl, or ruby. If you provided more information and some > sample input and expected output, we could probably help you more. > > Ed. I Want to insert "//" at the begining of all lines which have keyword MY_NAME in all files in all subfolders of a folder. e.g lines in a file earlier will be MY_NAME +=10; a=10; after running command it would be //MY_NAME +=10; a=10; thanks,
From: Janis Papanagnou on 30 Mar 2010 21:48 Tagore schrieb: >> Probably sed, awk, perl, or ruby. If you provided more information and some >> sample input and expected output, we could probably help you more. >> >> Ed. > > I Want to insert "//" at the begining of all lines which have keyword > MY_NAME in all files in all subfolders of a folder. A command to list all relevant files in a directory hierarchy is find(1), e.g. find /start/dir/ -name "*.cc" -exec ... > > e.g lines in a file earlier will be > MY_NAME +=10; > a=10; > > after running command it would be > //MY_NAME +=10; > a=10; A command to comment out specific lines determined by a pattern MY_NAME is sed(1), e.g. sed -i '/MY_NAME/s;^;//;' filename See 'man find' for the -exec format and 'man sed' to see whether it supports option -i for inplace editing (otherwise use a temporary file). Janis > > thanks,
From: Seebs on 30 Mar 2010 21:57 On 2010-03-31, Tagore <c.lang.myself(a)gmail.com> wrote: > I want to comment all lines in a C progamming project with a > particular string in it. No, you don't. > Which command to do it? This question incorrect grammar. Also, without a clearer statement of the question, your question is mostly unanswerable. Do you want to append a comment to those lines? Comment them out? Are you using C89 or C99 or some other variant? See also: http://www.catb.org/~esr/faqs/smart-questions.html -s -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
|
Pages: 1 Prev: Running two JVM ( different version ) on windows Next: ls -d does not do what I want/expect |