Sponsored Content
Top Forums Shell Programming and Scripting Using SED to generate new file from template Post 302338413 by edidataguy on Monday 27th of July 2009 11:57:10 PM
Old 07-28-2009
Double check your code.
Why are these lines repeated in your code? Intentionally done?
Code:
-e "s|CUR_MGMT_INT|$CUR_MGMT_INT|g"\
 -e "s|CUR_MGMT_INT|$CUR_MGMT_INT|g"\
 -e "s|CUR_MGMT_IP|$CUR_MGMT_IP|g"\
 -e "s|CUR_MGMT_IP|$CUR_MGMT_IP|g"\

I would sugest changing all the lines as follows:
Code:
; "s|CUR_MGMT_INT|$CUR_MGMT_INT|"\
; "s|CUR_MGMT_INT|$CUR_MGMT_INT|"\

Why do you need the "-e" and the "/g" options.

Regarding the " " issue post the input and the output.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

configuration and template file

Hi, I have a configuration file(which has values) and a template file(where the values are dummied) Configuration file (a.txt) -------------------- var1=1521 var2=172.10.10.10 var3=emp . . . var15=hhhhhhh Template file (b.txt) -------------------- The host name is $var2. The... (5 Replies)
Discussion started by: ammu
5 Replies

2. Shell Programming and Scripting

sed script to generate hyperlinks refuses to work

Hi All, I'm new to the forum and not a programmer, but I'm writing a bash script to preprocess definitions of technical terms by inserting hyperlinks pointing to other pages in the glossary before the pages are posted to our server, using a standard naming convention for the pages. The... (3 Replies)
Discussion started by: markfgilliland
3 Replies

3. Shell Programming and Scripting

Reading columns, making a new file using another as template

Hi fellas, I have two files such as: File 1 interacao,AspAsp,AspCys,CysAsp,CysCys,classe File 2 interacao,AspAsp,CysAsp,AspCys,CysCys,classe beta_alfa, DA, CA, DD, CD,ppi Thus, I want to make a File 3 using the File 1 as model: e.g. File 3... (2 Replies)
Discussion started by: valente
2 Replies

4. Shell Programming and Scripting

filling in strings in a template file using awk

Hi all, I have a template form to fill in for quite a number of files and I want to automate the filling-in process. the concept seemed to be simple but i cant get it work. the template form is a text file containing the information below: File Name: Date Created: Contents: I need to... (4 Replies)
Discussion started by: ida1215
4 Replies

5. Shell Programming and Scripting

Creating a larger .xml file from a template(sample file)

Dear All, I have a template xml file like below. ....Some---Header....... <SignalPreference> ... <SignalName>STRING</SignalName> ... </SignalPreference> ......Some formatting text....... <SignalPreference> ......... ... (3 Replies)
Discussion started by: ks_reddy
3 Replies

6. UNIX for Dummies Questions & Answers

XML File Generation - Template Help

Hi, I have hit a bit of a brick wall.:confused: need the following code edited: echo "<?xml version=\"1.0\"?><dailyBalance_ROWSET>" > ${DataDir}/${extract_script}${ApplicationDate}.${Suffix} RunSQL ${extract_script} ${ActionFlag} echo "</dailyBalance_ROWSET>" >>... (2 Replies)
Discussion started by: Xergxes7
2 Replies

7. Linux

Search a template file and replace with input

Hi I have a CommonTemplateStop.template file . Inside the file i need to replace the variables DepName and CompInsName with the values(Trade and TradeIns) specified in the script. I have written the below .sh script in linux server which will read the .template file and has to replace the 2... (8 Replies)
Discussion started by: samrat dutta
8 Replies

8. Shell Programming and Scripting

Inputing info from a CSV file and filling a template file

Hi, I have a .csv file that contains a variety of fields for 60 clients: USERNAME, PASSWORD, and COMMENTS. I have a template file which contains a great deal of data for each client and has the fields USERNAME, PASSWORD, and COMMENTS that has to be filled with the values of USERNAME,... (1 Reply)
Discussion started by: mojoman
1 Replies

9. Shell Programming and Scripting

Merge strings from a file into a template

I am preparing a morphological grammar of Marathi to be placed in open-source. I have two files. The first file called Adverbs contains a whole list of words, one word per line A sample is given below: आधी इतक इतपत उलट एवढ ऐवजी कड कडनं कडल कडील कडून कडे करता करिता खाल (2 Replies)
Discussion started by: gimley
2 Replies

10. UNIX for Beginners Questions & Answers

Generate files and use csv data to replace multiple variables in a template

I have a source csv file consists of first field as variable name, and the rest are site-specific information (converted from excel file, where site -specific values in columns). I am trying to create a file for every site using a template and replace the multiple variables with values from the... (3 Replies)
Discussion started by: apalex
3 Replies
XT-CREATE-XEN-CONFIG(8) 				 Perl Programmers Reference Guide				   XT-CREATE-XEN-CONFIG(8)

NAME
xt-create-config - Create a Xen configuration file for a new guest SYNOPSIS
xt-create-config [options] Filename Options: --output Specify the output directory to use. --extension Specify the file extension to use. General Options: --admins Specify some administrator accounts which should be created for use by the xen-shell. --template Specify the template file to use when creating the Xen configuration file. Help Options: --help Show this scripts help information. --manual Read this scripts manual. --version Show the version number and exit. Debugging Options: --verbose Be verbose in our execution. All other options from xen-create-image, such as the new IP address(es) to give to the new instance, will be passed as environmental variables. ABOUT
This script is invoked by xen-create-image after it has created and customised a new Xen guest. It is responsible for creating the configuration file which Xen will use to start the instance. The configuration file will be created in the directory /etc/xen using a template file to determine how the configuration file should be created. By default the script will use /etc/xen-tools/xm.tmpl as its input. INVOCATION
This script will be invoked by the xen-create-image script, rather than directly. This is because it will expect to receive the values to insert into the output template in as environmental variables. You could execute it manually via a long command line, but that is error-prone and probably not useful: hostname=foo.my.flat ip=192.168.1.2 ... xm-create-xen-config --output=/etc/xen --template=/etc/xen-tools/xm.tmpl ARGUMENT PASSING
This script will be invoked with a full copy of the arguments from xen-create-image in its environment, along with several command line arguments. This has several implications for customization. If you wish to setup a new variable in the output template such as "foo=bar" you could update the script to include "${foo}", then invoke xen-create-image with this environmental variable set. $ foo=bar xen-create-image --hostname=test.my.flat ... The environment will be duplicated/inheritted by this script when it is executed, and your variable will be included in the output file. For details on the template file syntax please see the documentation for the "Text::Template" perl module. (If you have the perldoc package installed you can read this with "perldoc Text::Template".) AUTHORS
Steve Kemp, http://www.steve.org.uk/ Axel Beckert, http://noone.org/abe/ StA~Xphane Jourdois LICENSE
Copyright (c) 2005-2009 by Steve Kemp, (c) 2010-2012 by The Xen-Tools Development Team. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The LICENSE file contains the full text of the license. 4.3.1 2012-06-30 XT-CREATE-XEN-CONFIG(8)
All times are GMT -4. The time now is 06:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy