I'm doing manual way to add and remove "#" on etc/services.
Is there anyway I can modify the file using awk or sed or any other program.
I use vi to modify /etc/services for enabling telnet , the problem is I don't know how to do it automatically in script.
production state:
#telnet
... (9 Replies)
I have a requirement like below.I need to Comment some lines in a file.
File contains following information.
{
attribute1
attribute2
atrribute3
attribute4
attribute5
attribute6
attribute7
}
I have a requirement like some times i need to comment lines 3 to before '}' and some... (1 Reply)
Hello,
I'm trying to make a shell script to skip comments from an XML file, but with the code below only deletes comments that are in one line.
Can you tell me what can be added here?
nawk '
{
if($0 !~/<!--/) { a=0 }
if($0 ~/<!--/ && $0 ~/-->/) {a=1}
if($0 ~/<!--/) {a=1}
if... (1 Reply)
How can I delete comments (lines beginning with /* and ending with */) in file?
with single command line..My suggestion is to use grep and sed! (4 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,
I have a files as shown below and I wanted to sort then in following patter based on there names which has "_" in it. I want to sort them according to feild 6th (bold once)value as shown below.
Thanks in advance.
File names:
20111014_manish_STEP2_Files_number__5979-6968_ ... (5 Replies)
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)
Hi
I have this sample data set as follows (called file.txt):
hostname1:user1:password
hostname2:user1:password #comments comments
hostname3:user1:passwordI wish to produce a report as follows:
hostname1 user1 password
hostname2 user1 password
hostname3 user1 passwordie remove all... (11 Replies)
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
LEARN ABOUT CENTOS
pmcpp
PMCPP(1) General Commands Manual PMCPP(1)NAME
pmcpp - simple preprocessor for the Performance Co-Pilot
SYNOPSIS
pmcpp [-D name[=value] ...] [infile]
DESCRIPTION
pmcpp provides a very simple pre-processor for manipulating Performance Metric Name Space (PMNS) files for the Performance Co-Pilot (PCP).
It is most commonly used internally to process the PMNS file(s) after pmLoadNameSpace(3) or pmLoadASCIINameSpace(3) is called.
Input lines are read from infile (or standard input if infile is not specified), processed and written to standard output.
All C-style comments of the form /* ... */ are stripped from the input stream.
There are no predefined macros for pmcpp although macros may be defined on the command line using the -D option, where name and value must
follow the same rules as described below for the #define directive.
pmcpp accepts the following directives in the input stream (like cpp(1)):
* #include "filename"
or
#include <filename>
In either case the directory search path for filename tries filename first, then the directory for the command line infile (if any),
followed by the $PCP_VAR_DIR/pmns directory. #include directives may be nested, up to a maximum depth of 5.
* #define name value
Defines a value for the macro name which must be a valid C-style name, so leading alphabetic or ``_'' followed by zero or more alphanu-
merics or ``_''. value is optional (and defaults to an empty value) but when present it may not contain white space and quoting or
escaping is not supported.
* #undef name
Removes the macro definition, if any, for name.
* #ifdef name
...
#endif
or
#ifndef name
...
#endif
The enclosing lines will be stripped or included, depending if the macro name is defined or not.
Macro substitution is achieved by breaking the input stream into words separated by white space or one of the characters ``.'' or ``:'' -
this matches the syntax of the PMNS, see pmns(5). Each word is checked and if it matches a macro name, the word is replaced by the macro
value, otherwise the word is unchanged.
There is generally one output line for each input line, although the line may be empty if the text has been stripped due to the handling of
comments or conditional directives. When there is a change in the input stream, an additional output line is generated of the form:
# line "name"
to indicate the following line of output corresponds to line number line of the input file name.
Important cpp(1) features that are not supported by pmcpp include:
* #if expr
...
#endif
* Nested use of #ifdef or #ifndef.
* #else within an #ifdef or #ifndef.
* Stripping C++ style comments, as in // comment
* Error recovery - the first error encountered by pmcpp will be fatal.
* cpp(1) command line options like -U , -P and -I.
PCP ENVIRONMENT
Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the
file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configura-
tion file, as described in pcp.conf(5).
SEE ALSO cpp(1), pmLoadASCIINameSpace(3), pmLoadNameSpace(3), pmns(5), pcp.conf(5) and pcp.env(5).
Performance Co-PilotPMCPP(1)