Sponsored Content
Top Forums Shell Programming and Scripting sed or awk to replace a value in a certain line from another file containing a string Post 302655217 by elixir_sinari on Wednesday 13th of June 2012 01:53:30 AM
Old 06-13-2012
Assuming that mesh.k contains only 1 number:

Code:
awk 'NR==FNR{num=$1;next} /[0-9]{1,}\.k$/ {sub("[0-9]{1,}\.k$",num".k")} {print}' mesh.k input.k

This User Gave Thanks to elixir_sinari For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed conditional string replace for each line

Hi all, I appreciate the enormous amount of knowledge that flows in this forum. I am an average UNIX user. I have many files with lines like the below. I have separated each line with space for ease of reading. I need to replace the first occurance of "/00" with null on those lines that have... (6 Replies)
Discussion started by: Nanu_Manju
6 Replies

2. Shell Programming and Scripting

Appending string (charachters inside the line) to a fixed width file using awk or sed

Source File: abcdefghijklmnop01qrstuvwxyz abcdefghijklmnop02qrstuvwxyz abcdefghijklmnop03qrstuvwxyz abcdefghijklmnop04qrstuvwxyz abcdefghijklmnop05qrstuvwxyz Whatever characters are in 17-18 on each line of the file, it should be concatenated to the same line at the character number... (6 Replies)
Discussion started by: tamahomekarasu
6 Replies

3. Shell Programming and Scripting

How to find a certain string in a file and replace it with a value from another file using sed/awk?

Hi Everyone, I am new to this forum and new to sed/awk programming too !! I need to find particular string in file1(text file) and replace it with a value from another text file(file2) the file2 has only one line and the value to be replaced with is in the second column. file 1: (assert (=... (21 Replies)
Discussion started by: paramad
21 Replies

4. Shell Programming and Scripting

replace (sed?) a single line/string in file with multiple lines (string) from another file??

Can someone tell me how I can do this? e.g: Say file1.txt contains: today is monday the 22 of NOVEMBER 2010 and file2.txt contains: the 11th month of How do i replace the word NOVEMBER with (5 Replies)
Discussion started by: tuathan
5 Replies

5. Shell Programming and Scripting

sed: how to replace string by another line

hi experts, i would like to do some html-file replacements and encounter the following problem: after cleaning up the file a bit i'd like to replace a regex with a reference and the content of another line. example: /<title>\(*\) - Wikipedia<\/title>/ should be replaced by \1 (the title... (2 Replies)
Discussion started by: chrisnie
2 Replies

6. Shell Programming and Scripting

sed or awk to replace a value in a certain line containing a string

hi experts , I have an input like following. R sfst 1000.0000 $ new time step for mass scaled calculation R dt2ms -4.000E-7 $ friction value for blank R mue ... (10 Replies)
Discussion started by: hamnsan
10 Replies

7. 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

8. Shell Programming and Scripting

Multiple line search, replace second line, using awk or sed

All, I appreciate any help you can offer here as this is well beyond my grasp of awk/sed... I have an input file similar to: &LOG &LOG Part: "@DB/TC10000021855/--F" &LOG &LOG &LOG Part: "@DB/TC10000021852/--F" &LOG Cloning_Action: RETAIN &LOG Part: "@DB/TCCP000010713/--A" &LOG &LOG... (5 Replies)
Discussion started by: KarmaPoliceT2
5 Replies

9. 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

10. Shell Programming and Scripting

Replace string of a file with a string of another file for matches using grep,sed,awk

I have a file comp.pkglist which mention package version and release . In 'version change' and 'release change' line there are two versions 'old' and 'new' Version Change: --> Release Change: --> cat comp.pkglist Package list: nss-util-devel-3.28.4-1.el6_9.x86_64 Version Change: 3.28.4 -->... (1 Reply)
Discussion started by: Paras Pandey
1 Replies
geo(1rheolef)                                                       rheolef-6.1                                                      geo(1rheolef)

NAME
geo - plot a finite element mesh SYNOPSIS
geo options mesh[.geo[.gz]] DESCRIPTION
Plot or upgrade a finite element mesh. EXAMPLES
Plot a mesh: geo square.geo geo box.geo geo box.geo -full Plot a mesh into a file: geo square.geo -image-format png Convert from a old geo file format to the new one: geo -upgrade - < square-old.geo > square.geo See below for the geo file format scpecification. The old file format does not contains edges and faces connectivity in 3d geometries, or edges connectivity in 2d geometries. The converter add it automatically into the upgraded file format. Conversely, the old file format is usefull when combined with a translator from another file format that do not provides edges and faces connectivity. INPUT FILE SPECIFICATION
filename specifies the name of the file containing the input mesh. The ".geo" suffix extension is assumed. - read mesh on standard input instead on a file. -name when mesh comes from standard input, the mesh name is not known and is set to "output" by default. This option allows to change this default. Useful when dealing with output formats (graphic, format conversion) that creates auxilliary files, based on this name. -Idir -I dir Add dir to the rheolef file search path. This mechanism initializes a search path given by the environment variable `RHEOPATH'. If the environment variable `RHEOPATH' is not set, the default value is the current directory. -check Check that element orientation is positive. INPUT FORMAT OPTIONS
-if format -input-format format load mesh in format file format, instead of plotting it. Supported output formats are: geo, bamg, vtk. When loading from a file, the corresponding suffix extension is assumed. RENDER SPECIFICATION
-gnuplot use gnuplot tool. This is the default. -mayavi use mayavi tool. RENDER OPTIONS
-lattice -nolattice When using a high order geometry, the lattice inside any element appears. Default is on; -subdivide int When using a high order geometry, the number of points per edge used to draw a curved element. Default value is the mesh order. -full -nofull All internal edges appears, for 3d meshes. Default is off; -fill -nofill Fill mesh faces using light effects, when available. -stereo -[no]stereo Rendering mode suitable for red-blue anaglyph 3D stereoscopic glasses. Option only available with mayavi. -cut -nocut cut by plane and clip (with mayavi only). OUTPUT FILE FORMAT OPTIONS
-geo output mesh on standard output stream in geo text file format, instead of plotting it. -upgrade Convert from a old geo file format to the new one. -gmsh output mesh on standard output stream in gmsh text file format, instead of plotting it. -image-format string The argument is any valid image format, such as bitmap png, jpg, gif or vectorial ps or pdf image file formats, and that could be handled by the corresponding render. The output file is e.g. `@emph{basename'.png} when @emph{basename} is the name of the mesh, or can be set with the -name option. OTHERS OPTIONS
-add-boundary check for a domain named "boundary"; If this domain does not exists, extract the boundary of the geometry and append it to the domain list. This command is usefull for mesh converted from generators, as bamg, that cannot have more than one domain specifica- tion per boundary edge. -verbose print messages related to graphic files created and command system calls (this is the default). -noverbose does not print previous messages. -clean clear temporary graphic files (this is the default). -noclean does not clear temporary graphic files. -execute execute graphic command (this is the default). -noexecute does not execute graphic command. Generates only graphic files. This is usefull in conjuction with the "-noclean" command. -check -dump used for debug purpose. INQUIRE OPTIONS
-min-element-measure -max-element-measure print the smallest (resp. largest) element measure and then exit. GEO FILE FORMAT
TODO rheolef-6.1 rheolef-6.1 geo(1rheolef)
All times are GMT -4. The time now is 09:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy