10-10-2008
help needed for multiline comment deleting script
Hi
I have a script to delete the multiline comments as below
********************************************
#!/usr/bin/sed -f
#Replaces single line comment
s://.*::
#Replaces multiline comment present in a single line
s:/\*[^\*/]*\*/::g
#Starting of the loop for checking the starting of the multi-line comment
/\/\*/!bc
#Searches for the ending part of the multiline comment
:a
/\*\//!{
N
ba
}
s:/\*.*\*/::
:c
*****************************************************
It is working fine in deleting the comments. However ther is a problem.
I am using it for a dml as below
****************************************************
record
ebcdic string(7) f7ezstat_as_of_date;
ebcdic string(2) f7ezstat_data_source;
packed decimal(15,0,unsigned) f7ezstat_hierarchy_key_1;
packed decimal(15,0,unsigned) f7ezstat_hierarchy_key_2;
ebcdic string(8) f7ezstat_hierarchy_key_3; /* needed */
packed decimal(15,0,unsigned) f7ezstat_hierarchy_key_4;
packed decimal(15,0,unsigned) f7ezstat_hierarchy_key_5;
packed decimal(15,0,unsigned) f7ezstat_hierarchy_key_6;
packed decimal(15,0,unsigned) f7ezstat_channel_id;
packed decimal(15,0,unsigned) f7ezstat_segment_id;
packed decimal(15,2) f7ezstat_volume;
end
****************************************************
here there is no new line character after the "end".
This is causing the problem.......
If the no. of fields between "record" and "end" is more than 9....
the o/p is
***************************************************
record
ebcdic string(7) f7ezstat_as_of_date;
ebcdic string(2) f7ezstat_data_source;
packed decimal(15,0,unsigned) f7ezstat_hierarchy_key_1;
packed decimal(15,0,unsigned) f7ezstat_hierarchy_key_2;
ebcdic string(8) f7ezstat_hierarchy_key_3;
packed decimal(15,0,unsigned) f7ezstat_hierarchy_key_4;
packed decimal(15,0,unsigned) f7ezstat_hierarchy_key_5;
packed decimal(15,0,unsigned) f7ezstat_hierarchy_key_6;
packed decimal(15,0,unsigned) f7ezstat_channel_id;
packed decimal(15,0,unsigned) f7ezstat_segment_id;
packed decimal(15,2) f7ezstat_volume;
****************************************************
The "end" goes missing......
but if the same is done with less than 9 fields....
all works fine....
we are using the following command to run it
sed -f sed.ksh f7_ez_f7ezstat_ebcdic.dml
here sed.ksh is the script to delete the comments and f7_ez_f7ezstat_ebcdic.dml is the dml.
Please help
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
how to put multiline comments in a shell script like /* Some code */ in C language? (3 Replies)
Discussion started by: skyineyes
3 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I wanted to check whether any files are available under the path /usr/app/logs/. If the files are available under this path then i have to delete all the files except the files system.log, system.log.1, system.log.2 and sub folders under this path
Can any one please help me on this?
... (2 Replies)
Discussion started by: Sheethal
2 Replies
3. Shell Programming and Scripting
Hi guys, hope you scripting gurus here can help me out, the logic in my script somehow not working the way it should, this script part of a bigger backup script suppose to do some checking on the cluster prior to bringing up the package on MC/SG after backend cloning operation, this portion is... (3 Replies)
Discussion started by: sparcguy
3 Replies
4. Shell Programming and Scripting
Hi guys i m trying to delete some files from one of the share which is mounted on my machine.
but whenever i do that it says access denied.
I m logged in as a root for my machine.
below is the output for those two file.
mount command for mounting the shares.
mount... (1 Reply)
Discussion started by: pinga123
1 Replies
5. Shell Programming and Scripting
In a LaTeX manuscript, I need to replace many occurrences of
\emph{some string}
with some string, i.e. whatever string is inside. The string inside often may extend over several lines, and there may be other occurences of curly brackets inside it. So for example
\emph{this \it{is} a... (5 Replies)
Discussion started by: sune
5 Replies
6. UNIX for Dummies Questions & Answers
Is thery any way to give comment to multiple line without explicitly specifying # at the begining of each line ? (2 Replies)
Discussion started by: hiten.r.chauhan
2 Replies
7. Shell Programming and Scripting
Hi,
I am writing a shell script, which should comment a if-fi loop in a file.
From google i found that, we can use below qualifier to comment a section of code,
:<<COMMENT
COMMENT
But i could not place these keywords before and after if-fi loop.
Any help would be appreciated.
Finally the... (2 Replies)
Discussion started by: successlin
2 Replies
8. Shell Programming and Scripting
Hi friends , I want to ignore single and multiline comment( enclosed by " \* *\" ) of a file whle reading it. I am using the below code.
nawk '/\/\*/{f=1} /\*\//{f=0;next} !f' proc.txt | while read str
do
...
done
The problem is its working partially. that is its failing in one... (1 Reply)
Discussion started by: neelmani
1 Replies
9. Shell Programming and Scripting
Hi,
I have a text like the one given below
status="Observation 1"
read1="Source rows not load"
read2="Score drop"
I want to create a csv and mail it out in such a way that all three lines will be in a single cell but as three lines.
For ex
Col C1
... (3 Replies)
Discussion started by: prasperl
3 Replies
10. UNIX for Beginners Questions & Answers
Hello,
I want to parse the contents of a multiline html tag
ex:
<html>
<body>
<p>some other text</p>
<div>
<p class="margin-bottom-0">
text1
<br>
text2
<br>
<br>
text3
</p>
</div>
</body> (15 Replies)
Discussion started by: SorcRR
15 Replies
hppac(3X) hppac(3X)
NAME
hppac: HPPACADDD(), HPPACCMPD(), HPPACCVAD(), HPPACCVBD(), HPPACCVDA(), HPPACCVDB(), HPPACDIVD(), HPPACLONGDIVD(), HPPACMPYD(), HPPAC-
NSLD(), HPPACSLD(), HPPACSRD(), HPPACSUBD() - HP 3000-mode packed-decimal library
SYNOPSIS
DESCRIPTION
This set of calls invokes the library functions for emulating 3000-mode (MPE V/E) packed-decimal operations. These functions are in
library which is searched when the option is used with or ld(1).
Performs packed-decimal addition.
Compares two packed-decimal numbers.
Converts an ASCII representation to packed-decimal.
Converts a binary representation to packed-decimal.
Converts a packed-decimal number to ASCII.
Converts a packed-decimal number to binary.
Performs packed-decimal division.
Performs packed-decimal division (alternate routine).
Performs packed-decimal multiplication.
Performs a packed-decimal normalizing left shift.
Performs a packed-decimal left shift.
Performs a packed-decimal right shift.
Performs packed-decimal subtraction.
For all operations, the value returned in the variable to which the compcode argument points is one of the following values of type
Result > 0 or operand1 > operand2
Result < 0 or operand1 < operand2
Result == 0 or operand1 == operand2
For all operations, the value returned in the variable to which the pacstatus argument points is one of the following values of type Their
meanings are intended to be obvious:
AUTHOR
The HPPAC library was developed by HP.
SEE ALSO
PA-RISC Systems Only hppac(3X)