LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-04-2003, 09:34 PM   #1
aaronzh
LQ Newbie
 
Registered: Jun 2003
Posts: 1

Rep: Reputation: 0
Question How sed strip /* comments


how to strip c comments using sed?
/* #include is commented */
This is a line in file.txt. I want to change it to
#include is uncommented in the file.
I am thinking of using
sed 's/\/* #include is commented *\//#include is uncommented/g' file.txt > file_new.txt
But it won't work. Who can shed some lights here.
Thanks.
 
Old 06-05-2003, 05:16 PM   #2
0x4B
Member
 
Registered: May 2003
Location: Nashville TN, USA
Distribution: Debian (I'm unstable)
Posts: 117

Rep: Reputation: 15
you need to escape the * too (it represents 0 or more of something)
sed "s/\/\*#include is commented\*\//#include is uncommented/"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
strip -s blackzone Linux - Newbie 1 09-01-2004 12:08 AM
strip command? blackzone Linux - General 2 07-09-2004 03:20 AM
Why strip binaries? rsamurti Slackware 4 06-27-2004 04:17 PM
looking for script - strip out all # comments itsjustme Programming 3 03-11-2004 10:57 AM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 06:12 AM


All times are GMT -5. The time now is 07:00 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration