Sponsored Content
Full Discussion: Remove comments...
Top Forums UNIX for Dummies Questions & Answers Remove comments... Post 8426 by Optimus_P on Thursday 11th of October 2001 09:43:13 AM
Old 10-11-2001
if you happen to be able to view the book "Mastering Regualr Expresstions" by Oreilly page 171-174 are pretty much dedicated to writeing a regx for this very purpose.

taken from the book:

Code:
/\*[^*]*\*+([^/*][^*]*\*+)*/

but still needing some refined work due to comments offten span multi lines.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

please explain this sed shell script to remove C++ comments.

#! /bin/sed -nf # Remove C and C++ comments, by Brian Hiles (brian_hiles@rocketmail.com) # Sped up (and bugfixed to some extent) by Paolo Bonzini (bonzini@gnu.org) # Works its way through the line, copying to hold space the text up to the # first special character (/, ", '). The original... (1 Reply)
Discussion started by: Priyaranjan
1 Replies

2. Shell Programming and Scripting

how can i remove comments in random positions in a file?(bash)

Suppose i have a file like this: #bla bla #bla bla bla bla bla Bla BLA BLA BLA #bla bla .... .... how can i remove all comments from every line,even if they are behind commands or strngs that are not comments? any idea how i could do that using awk? (2 Replies)
Discussion started by: bashuser2
2 Replies

3. Shell Programming and Scripting

Sed script, changing all C-comments to C++-comments

I must write a script to change all C++ like comments: // this is a comment to this one /* this is a comment */ How to do it by sed? With file: #include <cstdio> using namespace std; //one // two int main() { printf("Example"); // three }//four the result should be: (2 Replies)
Discussion started by: black_hawk
2 Replies

4. UNIX for Dummies Questions & Answers

Remove blank lines and comments from text file

Hi, I am using BASH. How can I remove any lines in a text file that are either blank or begin with a # (ie. comments)? Thanks in advance. Mike (3 Replies)
Discussion started by: msb65
3 Replies

5. Shell Programming and Scripting

sed remove css comments

Is there a way that I can use sed to remove lines with css comments like this? /* comment */ (9 Replies)
Discussion started by: gravesit
9 Replies

6. Shell Programming and Scripting

sed remove comments

I need to use sed to remove comments from files. I am using this, but it only works on comments that start at the beginning of the line. sed /^"\/\/"/d In most of the files I have comments like this: code // Comments or tab // Comments (5 Replies)
Discussion started by: gravesit
5 Replies

7. Shell Programming and Scripting

How to remove comments from a bash script?

I would like to remove comments from a bash script. In addition, I would like to remove lines that consist of only white spaces, and to remove blank lines. #!/bin/bash perl -pe 's/ *#.*$//g' $1 | grep -v ^]*$ | perl -pe 's/ +/ /g' > $2 # # $1 INFILE # $2 OUTFILE The above code... (10 Replies)
Discussion started by: LessNux
10 Replies

8. Shell Programming and Scripting

Remove comments from file with specific file name extensions

Hello Unix board community, I have to program a shell script, but I am a complete noob so I hope I get some help here. The assignment is as follows: The program removes all comments regardless of formatting or language from files with specific file name extensions (php, css, js, ...).... (3 Replies)
Discussion started by: TheZeusMan
3 Replies

9. UNIX for Dummies Questions & Answers

Remove SAS comments using UNIX

I have tried a lot, Need your help guys. SAS Program: data one ; /* Data step */ Input name $; /*Dec variables*/ I want to remove the commented part(/* Data step */) alone. I have tried using sed command but it is deleting the entire line itself. i need unix command to separate this and... (1 Reply)
Discussion started by: saaisiva
1 Replies

10. Shell Programming and Scripting

Remove comments like pattern from text

Hi , We need to remove comment like pattern from a code text. The possible comment expressions are as follows. Input BizComment : Special/*@ Name:bzt_53_3aea640a_51783afa_5d64_0 BizHidden:true @*/ /* lookup Disease Category Therapuetic Class */ a=b;... (6 Replies)
Discussion started by: VikashKumar
6 Replies
BIBLEDIT-RDWRT(1)					      General Commands Manual						 BIBLEDIT-RDWRT(1)

NAME
bibledit-rdwrt - Read or writes data to or from a Bibledit-Gtk Bible or project DESCRIPTION
Bibledit-rdwrt can read from or write to Bible data. Syntax: bibledit-rdwrt -r|-w project book chapter|0 fileName Breaking the syntax down we have: First parameter: -r|-w This can be either -r or -w which determines whether the remaining arguments are going to do a "read" operation from the specified Bibledit-Gtk Bible / project, or do a "write" operation to that Bible / project. Second parameter: project This gives the name of the Bibledit-Gtk Bible / project. All we have to do is ensure that the project name we want to access is a valid/existing one. Third parameter: book This is simply the 3-letter book code for the Bible book that is being read/written to. I.e., MAT for Matthew, GEN for Genesis, etc. Fourth parameter: chapter|0 This can be either a chapter number or 0 (zero) for reading/writing either an individual chapter or read- ing/writing a whole book (when the parameter is 0). Fifth parameter: fileName This is a temporary file name that we assign for our use with bibledit-rdwrt. For a read (-r) operation this fileName argument is the name of the file that will be created by bibledit-rdwrt containing a copy of the whole book (corresponding to the 3-letter code), or that contains the individual chapter contents (of a designated chapter) of an existing Bibledit-Gtk book file in the Bible / project. It should be prefixed with a path us. Since bibledit-rdwrt is a console operation, after AdaptIt calls it using ::wxExe- cute, it would need to read the resulting temporary file to grab the contents for its use. For a write (-w) operation this fileName argu- ment is the name of the temporary file that bibledit-rdwrt reads to get the text which it then writes to the appropriate Bible / project file. The temporary file can contain the text of a whole book, or just the text of a single chapter for the book specified by the book 3-letter code and the chapter (number) argument. bibledit-rdwrt may exit with 0 on success, or -1 on failure, as it sees fit. It may write to stdout or stderr, as it sees fit. LICENSE
This program is distributed under the GNU General Public License, as noted in each source file. Version 4.2 August 18 2011 BIBLEDIT-RDWRT(1)
All times are GMT -4. The time now is 09:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy