A tweak to scottn's solution which does not consume blank lines, handles lines with multiple comments, and strongly quotes the exclamation point to protect it from history expansion on shells that support that feature:
Caveat: This only works for simple single-line comments which do not contain a ">" (which, if I recall correctly, is allowed).
It may be a no-brainer, but the answer is escaping me right now:
I'm trying to write a little script to remove all comments from .c source... I was thinking sed, but I'm not a very strong regexp user (e.g. I suck with sed).
I tried dumping the file into:
sed -e 's/\/\* * \*\///g'
and several... (1 Reply)
#! /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)
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)
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)
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)
Hi everyone,
I've got a problem with converting C comments ( /* */ ) into C++ style ( // ) in some source file with sed. So far I've dealt with comments on one line, but I don't know how to convert when it is over multiple lines ...
So I already have something like this:
comments.sed
... (8 Replies)
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)
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)
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)
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
LEARN ABOUT DEBIAN
wml::all
wml::all(3) EN Tools wml::all(3)NAME
wml::all - WML Include Files Of All Categories
SYNOPSIS
#use wml::all
DESCRIPTION
This includes all existing standard WML include files of all categories. Use it only when you are a really lazy webmaster which just wants
all features WML can provide ;-) It is always better to include one of the "wml::xxx::all" include files.
The following categories currently exists:
Standard (std)
Here you can find all standard tagsets which everybody usually uses all the time.
Webdesign (des)
These are tagsets which help webdesigners of the 3rd generation fighting against the puristic plain HTML. Use with care.
Formatting (fmt)
Here you can find formatting environments, i.e. usually container tags which do special formatting.
Import (imp)
Here you can find import tags, i.e. usually tags which import external data and converts them to HTML.
Support (sup)
Some support stuff which is used in other include files.
System (sys)
All system related stuff.
User (usr)
The user specific include files. Should be extended by the webmaster for his users.
AUTHOR
Ralf S. Engelschall
rse@engelschall.com
www.engelschall.com
REQUIRES
Internal: P1
External: --
SEE ALSO wml::des::all(3), wml::fmt::all(3), wml::imp::all(3), wml::std::all(3), wml::sup::all(3), wml::sys::all(3), wml::usr::all(3).
EN Tools 2014-04-16 wml::all(3)