Sponsored Content
Top Forums Shell Programming and Scripting How do i use sed to replace string with values from a dictionary file Post 302341916 by summer_cherry on Friday 7th of August 2009 02:11:06 AM
Old 08-07-2009
recursively:
Code:
nawk 'NR==FNR{names[NR]=$0;max=NR}NR!=FNR{ind=NR%max;if(ind==0){ind=max}$1=names[ind];print $0;}' file1 file2

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using sed to replace a string in file with a string in a variable that contains spaces

Hi, i call my shell like: my_shell "my project name" my script: #!/bin/bash -vx projectname=$1 sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp cp temp test_config_doxy the following error occurres: sed s/'PROJECT_NAME ... (2 Replies)
Discussion started by: vivelafete
2 Replies

2. Shell Programming and Scripting

How to use sed to replace the a string in the same file using sed?

How do i replace a string using sed into the same file without creating a intermediate file? (7 Replies)
Discussion started by: gomes1333
7 Replies

3. Shell Programming and Scripting

Replace blank values for string using sed

Hi everyone, I was wondering how could from a file where each row is separated by tabulations, the row values where are in blank replace them by a string or value. My file has this form: 26/01/09 13:45:00 0 0 26/01/09 14:00:00 1495.601318 0 26/01/09 14:15:00 1495.601318 0 ... (4 Replies)
Discussion started by: tonet
4 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 replace string in file with stdin

Hi Im trying to do the following: grep -H Date: out/* | sed 's/':'/ /' | awk '$4 ~ /^/ {print $1}' | while read VARIABLE; do awk '{print $1,$3,$2}' $VARIABLE | sed (take stdin and replace a string in $VARIABLE) done What this is basically doing is finding all files with Date: in... (11 Replies)
Discussion started by: duonut
11 Replies

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

7. Shell Programming and Scripting

How to replace a string containing @ in a file using sed ?

I have a list of names and email addresses. Sample File - username=poga--poga@yahoo.com new-york,US 512834 username=poga123--poga123@hotmail.com new-jersey,US 0894753 Requirement is to replace the email ids as dummy_username@xyz.com using sed only. Output File -... (4 Replies)
Discussion started by: poga
4 Replies

8. Shell Programming and Scripting

sed - Replace string with file contents

Hello, I have two files: file1 and file2 file1 has the following info: --- host: "localhost" port: 3000 reporter_type: "zookeeper" zk_hosts: - "localhost:2181" file2 contains an IP address (1.1.1.1) What I want to do is replace localhost with 1.1.1.1, so that the... (4 Replies)
Discussion started by: Jay Kah
4 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
rumakeindex(1)							       teTeX							    rumakeindex(1)

NAME
rumakeindex - process a LaTeX index using Russian Cyrillic characters SYNOPSIS
rumakeindex basename DESCRIPTION
rumakeindex is used to run makeindex(1) on idx files that use Russian characters. It is part of the T2 package. rumakeindex runs sed(1) on the idx file to convert Cyrillic character commands to 8-bit ASCII characters; pipes the results through makein- dex(1); and then through tr(1) to do some final conversions. The results are placed in a KOI8-R encoded ind file. FILES
basename.idx LaTeX index entry file basename.ilg LaTeX index log file basename.ind LaTeX processed index file BUGS
None known, but report any bugs found to the authors. COPYRIGHT
The T2 package is Copyright 1997-1999 Werner Lemberg, Vladimir Volovich and any individual authors listed elsewhere in package files. It may be distributed under the conditions of the LaTeX Project Public License, either version 1.1 of this license or (at your option) any later version. SEE ALSO
makeindex(1), sed(1), tr(1), <ftp://ftp.vsu.ru/pub/tex/T2/README>. AUTHOR
Werner Lemberg <wl@gnu.org>, Vladimir Volovich <TeX@vvv.vsu.ru>. This manual page was written by C.M. Connelly <c@eskimo.com>, for the Debian GNU/Linux system. It may be used by other distributions with- out contacting the author. Any mistakes or omissions in the manual page are my fault; inquiries about or corrections to this manual page should be directed to me (and not to the primary author). teTeX September 2000 rumakeindex(1)
All times are GMT -4. The time now is 05:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy