Sponsored Content
Top Forums Shell Programming and Scripting Using sed to pattern match within a particular multiline block and take action Post 302710143 by Lem on Thursday 4th of October 2012 03:31:03 AM
Old 10-04-2012
Code:
sed -n '/fruitend/b blk;H;$b blk;b;:blk;x;s/^\(fruitend\)*\n//;/PATTERN/!P' <file

--
Bye
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk match a multiline pattern

Hello! i wanna match in a config file, one text with more than one lines, something like this: CACHE_SIZE{ 10000 M } I have problems with the ends of line, i think that i can match the end of the line with \n, but i can't get it Someone can help me with the regular expression? ... (18 Replies)
Discussion started by: claw82
18 Replies

2. Shell Programming and Scripting

delete block of lines when pattern does not match

I have this input file that I need to remove lines which represents more than 30 days of processing. Input file: On 11/17/2009 at 12:30:00, Program started processing...argc=7 Total number of bytes in file being processed is 390 Message buffer of length=390 was allocated successfully... (1 Reply)
Discussion started by: udelalv
1 Replies

3. Shell Programming and Scripting

Multiline pattern search using sed or awk

Hi friends, Could you please help me to resolve the below issue. Input file :- <Node> <username>abc</username> <password>ABC</password> <Node> <Node> <username>xyz</username> <password>XYZ</password> <Node> <Node> <username>mnp</username> ... (3 Replies)
Discussion started by: haiksuresh
3 Replies

4. Shell Programming and Scripting

sed pattern match problem

Hi all, hoping this is a simple one, tried looking but just can't see the solution As an example I've got a list of words that all start Ben..... Bendicks Benefiber Ben Benylin I need to only change the line Ben with Ben 10, ignoring the other lines. I tried the following ... (1 Reply)
Discussion started by: mrpugster
1 Replies

5. Shell Programming and Scripting

Match a pattern starting with sub-pattern using sed

Hi all, I've been experiencing a difficulty trying to match a number and write it to a new file. My input file is: input.txt It contains the lines: 103P 123587.256971 3.21472112 3.1517423 1.05897234566427 58.2146258 12.35478 25.3612489 What would be the sed command to... (17 Replies)
Discussion started by: Biederman
17 Replies

6. Shell Programming and Scripting

Sed Pattern Match

Hi, I would like to use SED to do the following string replacement: asd1abc to www1cda asd2abc to www2cda ... asd9abc to www9cda I can use 'asd.abc' to find the orignal string, however I don't know how to generate the target string. Any suggestion? Thanks, ... (2 Replies)
Discussion started by: mail4mz
2 Replies

7. UNIX for Dummies Questions & Answers

sed multiline pattern match

How can I write a script that takes a cisco config file and outputs every occurrence of two, or more, pattern matches through the whole config file? For example, out of a config file, i want to print out every line with interface, description and ip address through the whole file, and disregard... (3 Replies)
Discussion started by: knownasthatguy
3 Replies

8. Shell Programming and Scripting

sed : match one pattern then the next consecutive second pattern not working

Ive used this snippet of code on a solaris box thousands of times. But it isnt working on the new linux box sed -n '/interface LoopBack0/{N;/ ip address /p;}' *.conf its driving me nuts !! Is there something Im missing ? (7 Replies)
Discussion started by: popeye
7 Replies

9. Shell Programming and Scripting

Pattern match with awk/sed - help

I need to grep for the pattern text inside the square brackets which are in red and not in green..my current code greps patterns both of them, which i don't want Input fileref|XP_002371341.1| oxoacyl-ACP reductase, putative gb|EPT24759.1| 3-ketoacyl-(acyl-carrier-protein) reductase ... (2 Replies)
Discussion started by: selvankj
2 Replies

10. Shell Programming and Scripting

Get range out using sed or awk, only if given pattern match

Input: START OS:: UNIX Release: xxx Version: xxx END START OS:: LINUX Release: xxx Version: xxx END START OS:: Windows Release: xxx Version: xxx ENDHere i am trying to get all the information between START and END, only if i could match OS Type. I can get all the data between the... (3 Replies)
Discussion started by: Dharmaraja
3 Replies
mlib_VolumeRayCast_Blocked(3MLIB)			    mediaLib Library Functions				 mlib_VolumeRayCast_Blocked(3MLIB)

NAME
mlib_VolumeRayCast_Blocked, mlib_VolumeRayCast_Blocked_Parallel_Nearest_U8_U8, mlib_VolumeRayCast_Blocked_Parallel_Nearest_S16_S16, mlib_VolumeRayCast_Blocked_Parallel_Trilinear_U8_U8, mlib_VolumeRayCast_Blocked_Parallel_Trilinear_S16_S16, mlib_VolumeRay- Cast_Blocked_Divergent_Nearest_U8_U8, mlib_VolumeRayCast_Blocked_Divergent_Nearest_S16_S16, mlib_VolumeRayCast_Blocked_Divergent_Trilin- ear_U8_U8, mlib_VolumeRayCast_Blocked_Divergent_Trilinear_S16_S16 - cast a ray (or rays) through a 3D data set SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> mlib_status mlib_VolumeRayCast_Blocked_Parallel_Nearest_U8_U8(mlib_rays *rays, const mlib_blkvolume *blk, void *buffer); mlib_status mlib_VolumeRayCast_Blocked_Parallel_Nearest_S16_S16(mlib_rays *rays, const mlib_blkvolume *blk, void *buffer); mlib_status mlib_VolumeRayCast_Blocked_Parallel_Trilinear_U8_U8(mlib_rays *rays, const mlib_blkvolume *blk, void *buffer); mlib_status mlib_VolumeRayCast_Blocked_Parallel_Trilinear_S16_S16(mlib_rays *rays, const mlib_blkvolume *blk, void *buffer); mlib_status mlib_VolumeRayCast_Blocked_Divergent_Nearest_U8_U8(mlib_rays *rays, const mlib_blkvolume *blk, void *buffer); mlib_status mlib_VolumeRayCast_Blocked_Divergent_Nearest_S16_S16(mlib_rays *rays, const mlib_blkvolume *blk, void *buffer); mlib_status mlib_VolumeRayCast_Blocked_Divergent_Trilinear_U8_U8(mlib_rays *rays, const mlib_blkvolume *blk, void *buffer); mlib_status mlib_VolumeRayCast_Blocked_Divergent_Trilinear_S16_S16(mlib_rays *rays, const mlib_blkvolume *blk, void *buffer); DESCRIPTION
Each of these functions casts a ray (or rays) through a three-dimensional(3D) data set, then computes and returns the interpolated samples at each step along the way. In trilinear interpolation, the value at point P is computed from its eight surrounding neighbors based on the equation below. P = (1-a)*(1-b)*(1-c)*P0 + a*(1-b)*(1-c)*Px + (1-a)*b*(1-c)*Py + (1-a)*(1-b)*c*Pz + a*b*(1-c)*Pxy + a*(1-b)*c*Pxz + (1-a)*b*c*Pyz + a*b*c*Pxyz where a, b, and c are the fractional parts of the coordinates of point P. The trilinear interpolation is represented by the following figure: Please see the online man page on docs.sun.com or a print copy for the diagram. Figure that represents the trilinear interpolation In nearest neighbor operation, the sample value at point P is replaced by the value of the nearest neighbor voxel. PARAMETERS
Each of the functions takes the following arguments: rays Casting rays. blk Volume data in the blocked format. buffer Working buffer. RETURN VALUES
Each of the functions returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
mlib_VolumeRayCast_General(3MLIB), attributes(5) SunOS 5.10 10 Nov 2004 mlib_VolumeRayCast_Blocked(3MLIB)
All times are GMT -4. The time now is 10:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy