Sponsored Content
Top Forums Shell Programming and Scripting Need help with sed to match and replace a string Post 302927261 by mallak on Monday 1st of December 2014 05:38:11 PM
Old 12-01-2014
Sorry Rudy, I didn't get what that mean. The file in which I am trying to manuplate is generated by a software which I don't have control on how to generate the lines.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sed scripting, match text within line and replace

New to sed... Have a file foo.txt (below). Need to replace text on 2 lines, but can only feed sed the first few characters of each line (all lines are unique). So, in my example, I have put '$' in place of what I need to figure out how to feed the whole line. What I have thus far: sed -e... (6 Replies)
Discussion started by: boolean2222
6 Replies

2. Shell Programming and Scripting

Match pattern and replace with string

hi guys, insert into /*<new>*/abc_db.tbl_name this is should be replaced to insert into /*<new>*/${new}.tbl_name it should use '.' as delimiter and replace is there any way to do it using sed (6 Replies)
Discussion started by: sol_nov
6 Replies

3. Shell Programming and Scripting

SED to replace exact match, not first occurrence.

Lets say I have file.txt: (Product:Price:QuantityAvailable) (: as delimiter) Chocolate:5:5 Banana:33:3 I am doing a edit/update function. I want to change the Quantity Available, so I tried using the SED command to replace 5, but my Price which is also 5 is changed instead. (for the Banana... (13 Replies)
Discussion started by: andylbh
13 Replies

4. Shell Programming and Scripting

replace (sed?) a string in file with multiple lines (string) from variable

Can someone tell me how I can do this? e.g: a=$(echo -e wert trewt ertert ertert ertert erttert erterte rterter tertertert ert) How do i replace the STRING with $a? I try this: sed -i 's/STRING/'"$a"'/g' filename.ext but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies

5. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

6. Shell Programming and Scripting

sed Character match and replace

Hello All I am struck in the issue which I want to share with all of you. What I am trying to do is For every line in a file I have to replace a particular character from the given character in a file For Example Suppose the data is 1111x2222 1111x2222 2222y3333 1111x2222 I... (4 Replies)
Discussion started by: adisky123
4 Replies

7. Shell Programming and Scripting

Replace second match+awk/sed

I have a text file that looks like this: ----------------------------------------- sta WP00 time 10/23/2013 20:10:17 sensor trillium_240_2 0 583 add close sensor trillium_240_2 10/23/2013 20:10:17 sensor trillium_120 0 279 add close sensor trillium_120 10/23/2013 20:10:35... (11 Replies)
Discussion started by: klane
11 Replies

8. Shell Programming and Scripting

sed : replace Nth match in a file

I have a situation where a file "config.txt" looks like this Servername: OS: Serername: OS: Servername: OS: .... .... ... Servername: OS: looking for the sed syntax to replace the "Nth" occurrence of Servername (i would apply the same logic to OS as well), want to replace the Nth... (4 Replies)
Discussion started by: alldbest
4 Replies

9. Shell Programming and Scripting

Replace a string on specific lines which match a pattren

Hi Experts, I have a file which contains a pattern multiple times i.e. matchthispattren. If a line is matched with this pattern. I want a number in 1234567890 to 123456789 in that line. (Basically remove the last digit from that number. Please help. Thanks, Varun (1 Reply)
Discussion started by: varun22486
1 Replies

10. Shell Programming and Scripting

Replace string in XML file with awk/sed with string from another

Sorry for the long/weird title but I'm stuck on a problem I have. I have this XML file: </member> <member> <name>TransactionID</name> <value><string>123456789123456</string></value> </member> <member> <name>Number</name> ... (9 Replies)
Discussion started by: cozzin
9 Replies
pgmcrater(1)						      General Commands Manual						      pgmcrater(1)

NAME
pgmcrater - create cratered terrain by fractal forgery SYNOPSIS
pgmcrater [-number n] [-height|-ysize s] [-width|-xsize s] [-gamma g] All options can be abbreviated to their shortest unique prefix. DESCRIPTION
pgmcrater creates a PGM image which mimics cratered terrain. The PGM image is created by simulating the impact of a given number of craters with random position and size, then rendering the resulting terrain elevations based on a light source shining from one side of the screen. The size distribution of the craters is based on a power law which results in many more small craters than large ones. The number of craters of a given size varies as the reciprocal of the area as described on pages 31 and 32 of Peitgen and Saupe[1]; cratered bodies in the Solar System are observed to obey this relationship. The formula used to obtain crater radii governed by this law from a uniformly distributed pseudorandom sequence was developed by Rudy Rucker. High resolution images with large numbers of craters often benefit from being piped through pnmsmooth. The averaging performed by this process eliminates some of the jagged pixels and lends a mellow ``telescopic image'' feel to the overall picture. pgmcrater simulates only small craters, which are hemispherical in shape (regardless of the incidence angle of the impacting body, as long as the velocity is sufficiently high). Large craters, such as Copernicus and Tycho on the Moon, have a ``walled plain'' shape with a cross-section more like: / / _____/ \____________/\____________/ \_____ Larger craters should really use this profile, including the central peak, and totally obliterate the pre-existing terrain. OPTIONS
-number n Causes n craters to be generated. If no -number specification is given, 50000 craters will be generated. Don't expect to see them all! For every large crater there are many, many more tiny ones which tend simply to erode the landscape. In general, the more craters you specify the more realistic the result; ideally you want the entire terrain to have been extensively turned over again and again by cratering. High resolution images containing five to ten million craters are stunning but take quite a while to create. -height height Sets the height of the generated image to height pixels. The default height is 256 pixels. -width width Sets the width of the generated image to width pixels. The default width is 256 pixels. -xsize width Sets the width of the generated image to width pixels. The default width is 256 pixels. -ysize height Sets the height of the generated image to height pixels. The default height is 256 pixels. -gamma factor The specified factor is used to gamma adjust the image in the same manner as performed by pnmgamma. The default value is 1.0, which results in a medium contrast image. Values larger than 1 lighten the image and reduce contrast, while values less than 1 darken the image, increasing contrast. Note that this is separate from the gamma correction that is part of the definition of the PGM format. The image pnmgamma gener- ates is a genuine, gamma-corrected PGM image in any case. This option simply changes the contrast and may compensate for a dis- play device that does not correctly render PGM images. DESIGN NOTES
The -gamma option isn't really necessary since you can achieve the same effect by piping the output from pgmcrater through pnmgamma. How- ever, pgmcrater performs an internal gamma map anyway in the process of rendering the elevation array into the PGM format, so there's no additional overhead in allowing an additional gamma adjustment. Real craters have two distinct morphologies. SEE ALSO
pgm(5), pnmgamma(1), pnmsmooth(1) [1] Peitgen, H.-O., and Saupe, D. eds., The Science Of Fractal Images, New York: Springer Verlag, 1988. AUTHOR
John Walker Autodesk SA Avenue des Champs-Montants 14b CH-2074 MARIN Suisse/Schweiz/Svizzera/Svizra/Switzerland Usenet: kelvin@Autodesk.com Fax: 038/33 88 15 Voice: 038/33 76 33 Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, without any conditions or restrictions. This software is provided ``as is'' without express or implied warranty. PLUGWARE! If you like this kind of stuff, you may also enjoy ``James Gleick's Chaos--The Software'' for MS-DOS, available for $59.95 from your local software store or directly from Autodesk, Inc., Attn: Science Series, 2320 Marinship Way, Sausalito, CA 94965, USA. Telephone: (800) 688-2344 toll-free or, outside the U.S. (415) 332-2344 Ext 4886. Fax: (415) 289-4718. ``Chaos--The Software'' includes a more com- prehensive fractal forgery generator which creates three-dimensional landscapes as well as clouds and planets, plus five more modules which explore other aspects of Chaos. The user guide of more than 200 pages includes an introduction by James Gleick and detailed explanations by Rudy Rucker of the mathematics and algorithms used by each program. 15 October 1991 pgmcrater(1)
All times are GMT -4. The time now is 06:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy