help needed for multiline comment deleting script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help needed for multiline comment deleting script
# 1  
Old 10-10-2008
Data 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
# 2  
Old 10-10-2008
Please edit your post and use code tags [code] to for code and sample data.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Multiline html tag parse shell script

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

2. Shell Programming and Scripting

How to create multiline csv cell through shell script?

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

3. Shell Programming and Scripting

how to ignore multiline comment from a file while reading it

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

4. Shell Programming and Scripting

Need to comment some code via script

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

5. UNIX for Dummies Questions & Answers

multiline comment in shell script

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

6. Shell Programming and Scripting

Multiline parenthesis matching, with e.g. SED script, in LaTeX doc

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

7. Shell Programming and Scripting

Help needed for deleting the files.

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

8. Shell Programming and Scripting

Pls comment on my script.

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

9. UNIX for Dummies Questions & Answers

Help needed in deleting the files

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

10. Shell Programming and Scripting

Block Comment in Shell script

how to put multiline comments in a shell script like /* Some code */ in C language? (3 Replies)
Discussion started by: skyineyes
3 Replies
Login or Register to Ask a Question