Sponsored Content
Top Forums Shell Programming and Scripting Sed script, changing all C-comments to C++-comments Post 302373711 by Scott on Saturday 21st of November 2009 01:21:04 PM
Old 11-21-2009
Try:

Code:
# sed "s@//\(.*\)@/*\1*/@g" file1  
#include <cstdio>
using namespace std; /*one*/

/* two*/
int main() {
  printf("Example"); /*    three*/
}/*four*/

Of course, this doesn't cater for when there are // inside strings...
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to write comments in Korn shell script

What is the syntax for writing comment code in Korn shell scripts? (1 Reply)
Discussion started by: sasaliasim
1 Replies

2. Shell Programming and Scripting

Script for updating the comments field on /etc/passwd on redhat linux

Hi there, I have more that 300 servers that I need to updated the comments field on /etc/passwd for users that have a blank comments fields. The users have accounts on different servers. I have created a list of these users on a text file called update_passwd.txt. I need a script that will... (6 Replies)
Discussion started by: Linux Duke
6 Replies

3. 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

4. Shell Programming and Scripting

print only comments

I want to write a shell script which it takes as argument a java file or a c++ file (.java or .cpp). It will check if the file is type of java or c++, else it ends with error message. If all are ok, it will call awk that prints only the comments that the java or c++ file contains, grouping and... (5 Replies)
Discussion started by: Mark_orig
5 Replies

5. Shell Programming and Scripting

changing c comments to c++ style with sed

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)
Discussion started by: kolage
8 Replies

6. 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

7. 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

8. 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

9. Shell Programming and Scripting

Bash script to find comments in file

As I stated in a previous thread - I'm a newbie to Unix/Linux and programming. I'm trying to learn the basics on my own using a couple books and the exercises provided inside. I've reached an exercise that has me stumped. I need to write a bash script that will will read in a file and print the... (11 Replies)
Discussion started by: ksmarine1980
11 Replies
std::placeholders(3cxx) 												   std::placeholders(3cxx)

NAME
std::placeholders - SYNOPSIS
Variables const _Placeholder< 1 > _1 const _Placeholder< 10 > _10 const _Placeholder< 11 > _11 const _Placeholder< 12 > _12 const _Placeholder< 13 > _13 const _Placeholder< 14 > _14 const _Placeholder< 15 > _15 const _Placeholder< 16 > _16 const _Placeholder< 17 > _17 const _Placeholder< 18 > _18 const _Placeholder< 19 > _19 const _Placeholder< 2 > _2 const _Placeholder< 20 > _20 const _Placeholder< 21 > _21 const _Placeholder< 22 > _22 const _Placeholder< 23 > _23 const _Placeholder< 24 > _24 const _Placeholder< 25 > _25 const _Placeholder< 26 > _26 const _Placeholder< 27 > _27 const _Placeholder< 28 > _28 const _Placeholder< 29 > _29 const _Placeholder< 3 > _3 const _Placeholder< 4 > _4 const _Placeholder< 5 > _5 const _Placeholder< 6 > _6 const _Placeholder< 7 > _7 const _Placeholder< 8 > _8 const _Placeholder< 9 > _9 Detailed Description ISO C++ 0x entities sub namespace for functional. Define a large number of placeholders. There is no way to simplify this with variadic templates, because we're introducing unique names for each. Author Generated automatically by Doxygen for libstdc++ from the source code. libstdc++ Tue Nov 27 2012 std::placeholders(3cxx)
All times are GMT -4. The time now is 04:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy