LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 02-19-2004, 12:25 AM   #1
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Rep: Reputation: 45
looking for script - strip out all # comments


Hey, you scripters....

Anybody got a simple script I can use, sorta like:

$ strip_comments /etc/rc.d/rc.modules

and have the output just show all lines that don't have # in the first column?
This is no emergency or anything.

Thanks if you do and can post it...

I just haven't gotten around to writing any scripts yet.
 
Old 02-19-2004, 03:36 AM   #2
Strike
Member
 
Registered: Jun 2001
Location: Houston, TX, USA
Distribution: Debian
Posts: 569

Rep: Reputation: 31
grep -v "^#"

Pipe anything you want to that
 
Old 02-21-2004, 06:23 PM   #3
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Original Poster
Rep: Reputation: 45
Strike...

Exactly what I as looking for.

Thanks!!
 
Old 03-11-2004, 11:57 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,314

Rep: Reputation: 175Reputation: 175
If the comment is NOT the first character,
Like # here for instance

cat file | sed 's/#.*//' | grep .


billy
 
  


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 01:08 AM
strip command? blackzone Linux - General 2 07-09-2004 04:20 AM
How to remove or strip control chars in the 'script' utility? fieldmethods Linux - General 1 10-24-2003 02:11 PM
How sed strip /* comments aaronzh Programming 1 06-05-2003 06:16 PM
Program (or Script) to download Slashdot Article with Comments LinuxGeek Linux - General 1 08-24-2002 04:29 AM


All times are GMT -5. The time now is 07:32 PM.

Main Menu
Advertisement
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