Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Find a block of text and if a certain keyword exists, remove another block of text within that block Post 303046199 by sea on Monday 27th of April 2020 11:35:32 PM
Old 04-28-2020
Hi pulpwilkes and welcome to the forums

Some points missing:
  • Use code tags for code
  • What OS
  • What language / shell?

--- Post updated at 06:35 ---

Thanks for the updates.
  1. Your 'desired' output still contains a value-b=true 'block' --> purpose or accident?
  2. What have you tried so far? (sry forgot to ask before)
This User Gave Thanks to sea For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting text block in file

Need to delete a text block inside a file, that is marked with a start and an end pattern. Eg do not delete not delete <tag1> delete everything here here and here and here... <tag2> do not delete do not delete.... Believe sed is able to do this job but don't get it working. ... (1 Reply)
Discussion started by: andre123
1 Replies

2. UNIX for Advanced & Expert Users

awk - remove block of text, multiple actions for 'if', inline edit

I'm having a couple of issues. I'm trying to edit a nagios config and remove a host definition if a certain "host_name" is found. My thought is I would find host definition block containing the host_name I'm looking for and output the line numbers for the first and last lines. Using set, I will... (9 Replies)
Discussion started by: mglenney
9 Replies

3. Shell Programming and Scripting

Remove a block of Text at regular intervals

Hello all, I have a text files that consists of blocks of text. Each block of text represents a set of Cartesian coordinates for a molecule. Each block of text starts with a line that has a only a number, which is equal to the total number of atoms in the molecule. After this number is a line... (15 Replies)
Discussion started by: marcozd
15 Replies

4. Shell Programming and Scripting

How to insert text after a block of text?

Input: fstab is a configuration file that contains information of all the partitions and storage devices in your computer. The file is located under /etc, so the full path to this file is /etc/fstab. The >>>>> characters would be replaced by some texts. For example if i run a... (5 Replies)
Discussion started by: cola
5 Replies

5. Shell Programming and Scripting

Extract a block of text??

Hello all, I have a large output file from which I would like to extract a single block of text. An example block of text is shown below: ***** EQUILIBRIUM GEOMETRY LOCATED ***** COORDINATES OF ALL ATOMS ARE (ANGS) ATOM CHARGE X Y Z ... (10 Replies)
Discussion started by: marcozd
10 Replies

6. Shell Programming and Scripting

Filter or remove duplicate block of text without distinguishing marks or fields

Hello, Although I have found similar questions, I could not find advice that could help with our problem. The issue: We have several hundreds text files containing repeated blocks of text (I guess back at the time they were prepared like that to optmize printing). The block of texts... (13 Replies)
Discussion started by: samask
13 Replies

7. UNIX for Dummies Questions & Answers

Deleting Block of Text from a File

Hi I am looking for the way to delete the block of data for example original file line1 line2 line3 line4 line5 input file line2 line3 original file should contain line1 line4 line5 (3 Replies)
Discussion started by: rakeshkumar
3 Replies

8. Shell Programming and Scripting

Block of text replacement using sed

Hi, I have a requirement in which i need to replace text as below - <stringProp name="Recipe">&lt;AddGroup Name=&quot;1001&quot; Path=&quot;ServiceAdministration/Controls/1001/ServiceSwitches&quot;&gt; &lt;Param Name=&quot;AttributeName&quot; Value=&quot;HeaderManipRspIngressRuleSet&quot; Type=&quot;String&quot; /&gt; &lt;Param Name=&quot;Value&quot;... (0 Replies)
Discussion started by: abhitanshu
0 Replies

9. Shell Programming and Scripting

Grepping text block by block by using for loop

Hei buddies, Need ur help once again. I have a file which has bunch of lines which starts from a fixed pattern and ends with another fixed pattern. I want to make use of these fixed starting and ending patterns to select the bunch, one at a time. The input file is as follows. Hi welcome... (12 Replies)
Discussion started by: anushree.a
12 Replies

10. Shell Programming and Scripting

Extract a block of text

Hello all, I am working on a script which should parse a large file called input.txt which contains table definitions, index definitions and comments like these ones: ------------------------------------------------ -- DDL Statements for table "CMWSYS"."CMWD_TEC_SUIVI_TRT"... (12 Replies)
Discussion started by: kiki_riki_miki
12 Replies
Math::Polygon::Calc(3pm)				User Contributed Perl Documentation				  Math::Polygon::Calc(3pm)

NAME
Math::Polygon::Calc - Simple polygon calculations INHERITANCE
Math::Polygon::Calc is a Exporter SYNOPSIS
my @poly = ( [1,2], [2,4], [5,7], [1, 2] ); my ($xmin, $ymin, $xmax, $ymax) = polygon_bbox @poly; my $area = polygon_area @poly; MY $L = polygon_perimeter @poly; if(polygon_is_clockwise @poly) { ... }; my @rot = polygon_start_minxy @poly; DESCRIPTION
This package contains a wide variaty of relatively easy polygon calculations. More complex calculations are put in separate packages. FUNCTIONS
polygon_area(LIST-OF-POINTS) Returns the area enclosed by the polygon. The last point of the list must be the same as the first to produce a correct result. The algorithm was found at <http://mathworld.wolfram.com/PolygonArea.html>, and sounds: A = abs( 1/2 * (x1y2-x2y1 + x2y3-x3y2 ...) polygon_bbox(LIST-OF-POINTS) Returns a list with four elements: (xmin, ymin, xmax, ymax), which describe the bounding box of the polygon (all points of the polygon are within that area. polygon_beautify([HASH], LIST-OF-POINTS) Polygons, certainly after some computations, can have a lot of horrible artifacts: points which are double, spikes, etc. This functions provided by this module beautify The optional HASH contains the OPTIONS: -Option --Default remove_between <false> remove_spikes <false> remove_between => BOOLEAN Simple points in-between are always removed, but more complex points are not: when the line is not parallel to one of the axes, more intensive calculations must take place. This will only be done when this flags is set. NOT IMPLEMENTED YET remove_spikes => BOOLEAN polygon_centroid(LIST-OF-POINTS) Returns the centroid location of the polygon. The last point of the list must be the same as the first to produce a correct result. The algorithm was found at http://en.wikipedia.org/wiki/Centroid#Centroid_of_polygon polygon_clockwise(LIST-OF-POINTS) Be sure the polygon points are in clockwise order. polygon_contains_point(POINT, LIST-OF-POINTS) Returns true if the point is unside the closed polygon. polygon_counter_clockwise(LIST-OF-POINTS) Be sure the polygon points are in counter-clockwise order. polygon_equal(ARRAY-OF-POINTS, ARRAY-OF-POINTS, [TOLERANCE]) Compare two polygons, on the level of points. When the polygons are the same but rotated, this will return false. See polygon_same(). polygon_is_clockwise(LIST-OF-POINTS) polygon_is_closed(POINTS) polygon_perimeter(LIST-OF-POINTS) The length of the line of the polygon. This can also be used to compute the length of any line: of the last point is not equal to the first, then a line is presumed; for a polygon they must match. This is simply Pythagoras. $l = sqrt((x1-x0)^2 + (y1-y0)^2) + sqrt((x2-x1)^2+(y2-y1)^2) + ... polygon_same(ARRAY-OF-POINTS, ARRAY-OF-POINTS, [TOLERANCE]) Compare two polygons, where the polygons may be rotated wrt each other. This is (much) slower than polygon_equal(), but some algorithms will cause un unpredictable rotation in the result. polygon_start_minxy(LIST-OF-POINTS) Returns the polygon, where the point which is closest to the left-bottom corner of the bounding box is made first. polygon_string(LIST-OF-POINTS) SEE ALSO
This module is part of Math-Polygon distribution version 1.02, built on September 19, 2011. Website: http://perl.overmeer.net/geo/ LICENSE
Copyrights 2004,2006-2011 by Mark Overmeer. For other contributors see ChangeLog. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html perl v5.12.4 2011-09-19 Math::Polygon::Calc(3pm)
All times are GMT -4. The time now is 05:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy