Results 1 to 6 of 6
hi all
how to remove the line
first we have to search the line
if the line exist remove the line
else
dont do anything.
for example "disable_from_plugins" , this ...
- 09-13-2007 #1Linux Newbie
- Join Date
- Feb 2007
- Location
- hyderabad, india
- Posts
- 247
remove the line
hi all
how to remove the line
first we have to search the line
if the line exist remove the line
else
dont do anything.
for example "disable_from_plugins" , this is the word containing the line
search the line and delete.. programatically
can you please help me
thank you in advance"Relationships are built on trust and communication"
- 09-13-2007 #2Linux Newbie
- Join Date
- Feb 2007
- Location
- hyderabad, india
- Posts
- 247
hi i tried up to this
the output isCode:cat munna.c | grep disable_from_plugins
then hoe to remove the line that containing "disable_from_plugins".g_ref(disable_from_plugins);
and save the file..
and
if the word not find....
dont do any thing..
i prefer c or script.
please help me
thank you in advance"Relationships are built on trust and communication"
- 09-13-2007 #3Just Joined!
- Join Date
- Feb 2006
- Posts
- 6
I would try
This will output all lines except those matching the pattern disable_from_plugins, and direct it into outputfile.Code:cat munna.c | grep -v disable_from_plugins > outputfile
- 09-13-2007 #4Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
You don't need the cat - give grep the filename, or redirect the file. These are pretty much equivalent:
Or you could use sed and modify the source file directly:Code:grep -v disable_from_plugins munna.c >outfile grep -v disable_from_plugins <munna.c >outfile
Code:sed -i /disable_from_plugins/d munna.c
- 10-03-2007 #5Linux Newbie
- Join Date
- Feb 2007
- Location
- hyderabad, india
- Posts
- 247
hi
i have another problem with this
i would not like to remove the line.
just wanna do some changes in the line..
for example "disable_from_plugins" , this is the word containing the line
search the line and change the line i.e
rame("rr.disable_from_plugins", 2);
to
"rame("rr.disable_from_plugins", 1);"
and save by programatically
can you please help me
thank you in advance"Relationships are built on trust and communication"
- 10-03-2007 #6
If this is stuff you're going to be doing regularly, and the solution fits, you might want to use the c pre processor for this.


Reply With Quote
