The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Multiline Grep tolmark UNIX for Dummies Questions & Answers 4 03-13-2008 09:31 PM
handling Multiline SQL outputs decci_7 Shell Programming and Scripting 5 01-08-2008 04:29 PM
Awk Compare Files w/Multiline Records RacerX Shell Programming and Scripting 4 12-21-2007 03:05 AM
Help needed in deleting the files Sheethal UNIX for Dummies Questions & Answers 2 11-13-2007 06:20 AM
Block Comment in Shell script skyineyes Shell Programming and Scripting 3 07-02-2007 04:15 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 10-10-2008
Registered User
 

Join Date: Jul 2008
Posts: 3
Unhappy 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
Reply With Quote
Forum Sponsor
  #2  
Old 10-10-2008
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 727
Please edit your post and use code tags [code] to for code and sample data.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
code, multiline comments, sed

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:56 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0