If you enjoyed this article, please consider sharing it!
Sci/Tech – Google News- Moon meteor blast was visible to naked eye: NASA - Zee News - India - Zee News 19 May 2013
- BMW 5 Series LCI - Sedan, Touring and Gran Turismo - ASEAN Automotive News (blog) 19 May 2013
- Check out the new 2013 Peugeot RCZ Magnetic Limited Edition - Motoroids 19 May 2013
- Google Glass: Cool or creepy? - Mail & Guardian Online 19 May 2013
- Lexus IS - TRD works its magic on the third-gen - ASEAN Automotive News (blog) 19 May 2013


Bash Script – Delete Comments from a C program
I wrote a bash script to delete comments from a C program. C language will required /* and */ between the contents of the comment. Example as below:
This bash script will help to clear out whatever character contains between these 2 comment characters. I am using sed, which is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline) and also with some help from Regex. Script as below:
If the script name saved as comment_remover under root directory and the target file is /home/user1/program.c , you can execute the script as follow (make sure the script is executable):
It will turn the example I use above to:
I hope this will help some other people out there. Happy scripting!
Related Posts