Hey, thank you for that... I did not see it was duplicated... it did not keep the script from running, it just addded unecessary steps to it..
Quote:
Originally Posted by edidataguy
Why do you need the "-e" and the "/g" options.
Well, I am new to sed, but from what I read -e is to inform that the following is still part of the script (instead of going sed "1..."; sed "2..."; sed "3..." you use sed -e "1..." -e "2..." -e "2..."). As for g, it is to replace all occurrences of searched text, isn't it? Well they may appear more than once on the template files...
Quote:
Originally Posted by edidataguy
Regarding the " " issue post the input and the output.
Here is one record from the source file (all sensitive data was replaced, line break for readability):
This record will use the following template according to its UnID (in red):
And when I run the script, this is the output file:
Details in blue are placeholder (on template) and replaced data (on output). Deatils in orange are unwanted characters that sed is including to the output file. I wanted to understand (1) why is it happening and (2) what can I do to prevent that?
Well too many things in one go.
Lets split them.
Ragarding:
You need not call sed again and again.
As an example, the code can be as follows:
In your case you don't need the "/G". Without it, the command will run faster.
Well too many things in one go.
Lets split them.
Ragarding:
You need not call sed again and again.
As an example, the code can be as follows:
In your case you don't need the "/G". Without it, the command will run faster.
Ok, I'll give it a try without "-e" and "/g"... and for the duplicate replacements, already scraped them
---------- Post updated at 01:51 PM ---------- Previous update was at 01:43 PM ----------
tried... worked just fine... on this particular case, speed was not really an issue as the script ran for about 10 seconds or less (for a 950 records source file).
Regarding " " and the ESS thing, all that I can think of is there is some junk char somewhere.
The first thing I will do is search for \r\n and replace with \n for both, the input as well as the code and run them again.
Else look for some other chars which you cannot see.
Beyond this I cannot help you, sorry.
If you do fix it, please do get back.
Regarding " " and the ESS thing, all that I can think of is there is some junk char somewhere.
The first thing I will do is search for \r\n and replace with \n for both, the input as well as the code and run them again.
Else look for some other chars which you cannot see.
Beyond this I cannot help you, sorry.
If you do fix it, please do get back.
I fixed the quotes... I actually rebuilt the csv file from the Excel original. No more quotes now. However, I still get the ESS. I was careful to open the csv file at Notepad++ (Windows application) that allows me to convert the file to UNIX format. After that, I opened the file on Ubuntu with gnumeric, all good, no hidden chars.
Funny thing is that I only get it on one specific field (ROUTING_PROC), which I usually have ospf 1234 or eigrp 1234 as a value (numbers may actually vary). It keeps bringing ospf 1234ESS BUT it will not do it to eigrp 1234 values. That is rather strange. Did you have the chance to try it using the script and the sample input record?
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)
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)
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)
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)
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)
Dear All,
I have a template xml file like below.
....Some---Header.......
<SignalPreference>
...
<SignalName>STRING</SignalName>
...
</SignalPreference>
......Some formatting text.......
<SignalPreference>
.........
... (3 Replies)
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)
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)
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)
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)