LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Automatically deleting a line using find, grep, and vim (https://www.linuxquestions.org/questions/linux-newbie-8/automatically-deleting-a-line-using-find-grep-and-vim-904363/)

Jae-Yong Yoo 09-22-2011 03:16 AM

Automatically deleting a line using find, grep, and vim
 
Hello,
would it be possible the following?

Imagine there are multiple files, for instance
this.c
that.c
...

In these files, you want to find a line that contains #include <stdbool.h> and delete the line.

Is it possible to do that using find, grep, vim or else?

Jaeyong

grail 09-22-2011 04:34 AM

Else would be sed.

jv2112 09-22-2011 04:45 AM

Further Clarification -->

sed -i '#include <stdbool.h>/d' this.c

The above command will delete those lines & write to the file. The link below is further info.


http://www.thegeekstuff.com/2009/09/...itute-command/

Jae-Yong Yoo 09-22-2011 05:06 AM

Thanks :)


All times are GMT -5. The time now is 05:02 AM.