The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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-14-2008 12:31 AM
handling Multiline SQL outputs decci_7 Shell Programming and Scripting 5 01-08-2008 07:29 PM
Awk Compare Files w/Multiline Records RacerX Shell Programming and Scripting 4 12-21-2007 06:05 AM
Help needed in deleting the files Sheethal UNIX for Dummies Questions & Answers 2 11-13-2007 09:20 AM
Block Comment in Shell script skyineyes Shell Programming and Scripting 3 07-02-2007 07:15 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-10-2008
aster007 aster007 is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 11
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
  #2 (permalink)  
Old 10-10-2008
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,369
Please edit your post and use code tags [code] to for code and sample data.
Sponsored Links
Closed Thread

Bookmarks

Tags
code, multiline comments, sed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 07:34 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0