deleting lines within a portion of a file

General discussions about Advanced Find and Replace
Post Reply
pouncey
Posts: 3
Joined: Fri Apr 15, 2005 5:43 pm
Location: Atlanta, Georgia U.S.A.
Contact:

deleting lines within a portion of a file

Post by pouncey » Fri Apr 15, 2005 5:53 pm

I need to delete lines within a certain portion of a file.

All of the lines I need to delete begin with "<ShapeRect". I have a regular expression that is very good at finding these lines but it finds them ALL. This is bad. :(

The portion of text that needs editing begins with "<AFrames" and ends with "> # end of AFrames".

Is there a way to do this with Advanced Find and Replace? I am currently using Version 2.0.

Thank you for any help you can offer.

Russ Pouncey

Abacre
Site Admin
Posts: 1198
Joined: Mon Jan 31, 2005 5:32 pm
Contact:

Post by Abacre » Fri Apr 15, 2005 8:08 pm

Hi Russ,

Sure you can do that with AFR. The cue is with Modifier S (it should
be ON).

So
<AFrames.+> # end of AFrames
Will find the text having several lines between <AFrames and > # end of AFrames

But could you post one of you files here? I wan to see exact layout.
Ideally you should post the file body before (source) and after
replace (how it should be)
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

pouncey
Posts: 3
Joined: Fri Apr 15, 2005 5:43 pm
Location: Atlanta, Georgia U.S.A.
Contact:

Post by pouncey » Wed Apr 20, 2005 6:54 pm

Roman,

Thank you for the quick reply. I do not see how to attach a file, so the info you requested is below...


<MIFFile 7.00> # Generated by FrameMaker 7.0p578
.
. about 18,000 lines of stuff
.
#
# Within the block of text bracketed by "<AFrames" and "> # end of AFrames",
# I would like to remove all lines beginning with "<ShapeRect" and all lines
# beginning with "<BRect". Also, I need to change "<ImportObFixedSize Yes>" to
# "<ImportObFixedSize No>" and to change "<BitMapDpi 0>" to "<BitMapDpi 96>".
#
<AFrames
<Frame
<ID 1>
<Unique 998455>
<Pen 15>
<Fill 15>
<PenWidth 1.0 pt>
<Separation 0>
<ObColor `Black'>
<DashedPattern
<DashedStyle Solid>
> # end of DashedPattern
<RunaroundGap 6.0 pt>
<RunaroundType None>
<Angle 360.0>
<ShapeRect 0.875" 3.41873" 1.16667" 1.16667">
<BRect 0.875" 3.41873" 1.16667" 1.16667">
<FrameType Inline>
<NSOffset 0.0">
<BLOffset 0.0">
<AnchorAlign Center>
<Cropped No>
<ImportObject
<Unique 998457>
<Separation 0>
<ObColor `Black'>
<ImportObFileDI `<c\>AOI_island_poly.gif'>
<ImportObFile `AOI_island_poly.gif'>
<ImportHint `0001FRAMGIF WIN3 '>
<ImportObUpdater `GIF'>
<ShapeRect 0.0" 0.0" 1.16667" 1.16667">
<BRect 0.0" 0.0" 1.16667" 1.16667">
<ImportObFixedSize Yes>
<BitMapDpi 0>
<FlipLR No>
> # end of ImportObject
> # end of Frame
> # end of AFrames
.
. about 22,000 more lines of stuff
.
#
# In all other sections of the document, the ShapeRect and BRect lines
# must remain unchanged.
#
<Page
<Unique 996720>
<PageType BodyPage>
<PageNum `25'>
<PageTag `'>
<PageSize 8.5" 11.0">
<PageOrientation Portrait>
<PageAngle 0.0>
<PageBackground `First'>
<TextRect
<ID 47>
<Unique 998291>
<Pen 15>
<Fill 15>
<PenWidth 1.0 pt>
<Separation 0>
<ObColor `Black'>
<DashedPattern
<DashedStyle Solid>
> # end of DashedPattern
<RunaroundGap 0.0 pt>
<RunaroundType None>
<ShapeRect 0.625" 1.125" 7.0" 8.625">
<BRect 0.625" 1.125" 7.0" 8.625">
<TRNumColumns 1>
<TRColumnGap 0.25">
<TRColumnBalance No>
<TRSideheadWidth 1.5">
<TRSideheadGap 0.25">
<TRSideheadPlacement Left>
<TRNext 48>
> # end of TextRect
> # end of Page
.
. etc.
.
# End of MIFFile
[/code]

pouncey
Posts: 3
Joined: Fri Apr 15, 2005 5:43 pm
Location: Atlanta, Georgia U.S.A.
Contact:

restricted area find and replace

Post by pouncey » Fri May 27, 2005 10:04 pm

Roman,

I very much need to know how to do this. If it is not possible with Advanced Find and Replace, please let me know. I must find a solution and I need to know if I should look elsewhere.

I am still at a loss as to how to attach a sample file using this interface so I will do what I did before with the source. Below, please find the result of replacement.

------------------------------------------------------------------------------------------------------------------


<MIFFile 7.00> # Generated by FrameMaker 7.0p578
.
. about 18,000 lines of stuff
.
#
# Within the block of text bracketed by "<AFrames" and "> # end of AFrames",
# I would like to remove all lines beginning with "<ShapeRect" and all lines
# beginning with "<BRect". Also, I need to change "<ImportObFixedSize Yes>" to
# "<ImportObFixedSize No>" and to change "<BitMapDpi 0>" to "<BitMapDpi 96>".
#
# Lines marked with an * are affected and ONLY those lines
#
<AFrames
<Frame
<ID 1>
<Unique 998455>
<Pen 15>
<Fill 15>
<PenWidth 1.0 pt>
<Separation 0>
<ObColor `Black'>
<DashedPattern
<DashedStyle Solid>
> # end of DashedPattern
<RunaroundGap 6.0 pt>
<RunaroundType None>
<Angle 360.0>
*
*
<FrameType Inline>
<NSOffset 0.0">
<BLOffset 0.0">
<AnchorAlign Center>
<Cropped No>
<ImportObject
<Unique 998457>
<Separation 0>
<ObColor `Black'>
<ImportObFileDI `<c\>AOI_island_poly.gif'>
<ImportObFile `AOI_island_poly.gif'>
<ImportHint `0001FRAMGIF WIN3 '>
<ImportObUpdater `GIF'>
*
*
* <ImportObFixedSize No>
* <BitMapDpi 96>
<FlipLR No>
> # end of ImportObject
> # end of Frame
> # end of AFrames
.
. about 22,000 more lines of stuff
.
#
# In all other sections of the document, the ShapeRect and BRect lines
# must remain unchanged.
#
<Page
<Unique 996720>
<PageType BodyPage>
<PageNum `25'>
<PageTag `'>
<PageSize 8.5" 11.0">
<PageOrientation Portrait>
<PageAngle 0.0>
<PageBackground `First'>
<TextRect
<ID 47>
<Unique 998291>
<Pen 15>
<Fill 15>
<PenWidth 1.0 pt>
<Separation 0>
<ObColor `Black'>
<DashedPattern
<DashedStyle Solid>
> # end of DashedPattern
<RunaroundGap 0.0 pt>
<RunaroundType None>
<ShapeRect 0.625" 1.125" 7.0" 8.625">
<BRect 0.625" 1.125" 7.0" 8.625">
<TRNumColumns 1>
<TRColumnGap 0.25">
<TRColumnBalance No>
<TRSideheadWidth 1.5">
<TRSideheadGap 0.25">
<TRSideheadPlacement Left>
<TRNext 48>
> # end of TextRect
> # end of Page
.
. etc.
.
# End of MIFFile
-------------------------------------------------------------------------------------------------------------------

Please help if you can. I am willing to send complete before and after example files if you can explain how.

Thank you very much.

Russ Pouncey

Abacre
Site Admin
Posts: 1198
Joined: Mon Jan 31, 2005 5:32 pm
Contact:

Post by Abacre » Tue May 31, 2005 5:15 pm

Hi Russ,

Sorry I have not seen your first reply with sample file. Yes, it's
possible to do with AFR. Tomorrow send you complete set of
search/replace pairs.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Abacre
Site Admin
Posts: 1198
Joined: Mon Jan 31, 2005 5:32 pm
Contact:

Post by Abacre » Thu Jun 02, 2005 3:59 pm

Hi Russ,

Let's explain how to do it with AFR.
For example, source text:

Code: Select all

<MIFFile 7.00> # Generated by FrameMaker 7.0p578
.
. about 18,000 lines of stuff
.
#
# Within the block of text bracketed by "<AFrames" and "> # end of AFrames",
# I would like to remove all lines beginning with "<ShapeRect" and all lines
# beginning with "<BRect". Also, I need to change "<ImportObFixedSize Yes>" to
# "<ImportObFixedSize No>" and to change "<BitMapDpi 0>" to "<BitMapDpi 96>".
#
# Lines marked with an * are affected and ONLY those lines
#
<AFrames
<Frame
<ID 1>
<Unique 998455>
<Pen 15>
<Fill 15>
<PenWidth 1.0 pt>
<Separation 0>
<ObColor `Black'>
<DashedPattern
<DashedStyle Solid>
> # end of DashedPattern
<RunaroundGap 6.0 pt>
<RunaroundType None>
<Angle 360.0>
*
*
<FrameType Inline>
<NSOffset 0.0">
<BLOffset 0.0">
<AnchorAlign Center>
<Cropped No>
<ImportObject
<Unique 998457>
<Separation 0>
<ObColor `Black'>
<ImportObFileDI `<c\>AOI_island_poly.gif'>
<ImportObFile `AOI_island_poly.gif'>
<ImportHint `0001FRAMGIF WIN3 '>
<ImportObUpdater `GIF'>
*
*
* <ImportObFixedSize No>
* <BitMapDpi 96>
<FlipLR No>
> # end of ImportObject
> # end of Frame
> # end of AFrames
.
. about 22,000 more lines of stuff
.
#
# In all other sections of the document, the ShapeRect and BRect lines
# must remain unchanged.
#
<Page
<Unique 996720>
<PageType BodyPage>
<PageNum `25'>
<PageTag `'>
<PageSize 8.5" 11.0">
<PageOrientation Portrait>
<PageAngle 0.0>
<PageBackground `First'>
<TextRect
<ID 47>
<Unique 998291>
<Pen 15>
<Fill 15>
<PenWidth 1.0 pt>
<Separation 0>
<ObColor `Black'>
<DashedPattern
<DashedStyle Solid>
> # end of DashedPattern
<RunaroundGap 0.0 pt>
<RunaroundType None>
<ShapeRect 0.625" 1.125" 7.0" 8.625">
<BRect 0.625" 1.125" 7.0" 8.625">
<TRNumColumns 1>
<TRColumnGap 0.25">
<TRColumnBalance No>
<TRSideheadWidth 1.5">
<TRSideheadGap 0.25">
<TRSideheadPlacement Left>
<TRNext 48>
> # end of TextRect
> # end of Page
.
. etc.
.
# End of MIFFile


and the resulting text should be:

Code: Select all

<MIFFile 7.00> # Generated by FrameMaker 7.0p578
.
. about 18,000 lines of stuff
.
#
# Within the block of text bracketed by "<AFrames" and "> # end of AFrames",
# I would like to remove all lines beginning with "<ShapeRect" and all lines
# beginning with "<BRect". Also, I need to change "<ImportObFixedSize Yes>" to
# "<ImportObFixedSize No>" and to change "<BitMapDpi 0>" to "<BitMapDpi 96>".
#
<AFrames
<Frame
<ID 1>
<Unique 998455>
<Pen 15>
<Fill 15>
<PenWidth 1.0 pt>
<Separation 0>
<ObColor `Black'>
<DashedPattern
<DashedStyle Solid>
> # end of DashedPattern
<RunaroundGap 6.0 pt>
<RunaroundType None>
<Angle 360.0>   
<FrameType Inline>
<NSOffset 0.0">
<BLOffset 0.0">
<AnchorAlign Center>
<Cropped No>
<ImportObject
<Unique 998457>
<Separation 0>
<ObColor `Black'>
<ImportObFileDI `<c\>AOI_island_poly.gif'>
<ImportObFile `AOI_island_poly.gif'>
<ImportHint `0001FRAMGIF WIN3 '>
<ImportObUpdater `GIF'>   
<ImportObFixedSize No>
<BitMapDpi 96>
<FlipLR No>
> # end of ImportObject
> # end of Frame
> # end of AFrames
.
. about 22,000 more lines of stuff
.
#
# In all other sections of the document, the ShapeRect and BRect lines
# must remain unchanged.
#
<Page
<Unique 996720>
<PageType BodyPage>
<PageNum `25'>
<PageTag `'>
<PageSize 8.5" 11.0">
<PageOrientation Portrait>
<PageAngle 0.0>
<PageBackground `First'>
<TextRect
<ID 47>
<Unique 998291>
<Pen 15>
<Fill 15>
<PenWidth 1.0 pt>
<Separation 0>
<ObColor `Black'>
<DashedPattern
<DashedStyle Solid>
> # end of DashedPattern
<RunaroundGap 0.0 pt>
<RunaroundType None>
<ShapeRect 0.625" 1.125" 7.0" 8.625">
<BRect 0.625" 1.125" 7.0" 8.625">
<TRNumColumns 1>
<TRColumnGap 0.25">
<TRColumnBalance No>
<TRSideheadWidth 1.5">
<TRSideheadGap 0.25">
<TRSideheadPlacement Left>
<TRNext 48>
> # end of TextRect
> # end of Page
.
. etc.
.
# End of MIFFile



What should you do:
Please download the latest version of the program:
http://www.abacre.com/download/afrexe.zip

This is only updated EXE file. You need to extract executable file from
zip archive into folder where the program is installed. So you will
replace old executable file by this new one.

Start the program. Go to main menu - Action - Options - "Batch
replace" check on the options:
Replace until found is ON
Modifier S is ON.

Press OK.

In main window go to Batch replace tab.
Check on "Use regular expressions".
Then fill the grid:
Search for:
(<AFrames.*)\r\n<ShapeRect.+>(.*> # end of AFrames)
Replace with:
$1$2
Search for:
(<AFrames.*)\r\n<BRect.+>(.*> # end of AFrames)
Replace with:
$1$2
Search for:
(<AFrames.*)\r\n<ImportObFixedSize Yes>(.*> # end of AFrames)
Replace with:
$1\r\n<ImportObFixedSize No>$2
Search for:
(<AFrames.*)\r\n<BitMapDpi 0>(.*> # end of AFrames)
Replace with:
$1\r\n<BitMapDpi 96>$2

That's all. You may press now Execute button.
I verified it perfectly works. The program produced the resulting text
as above.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests