Inserting data from another source


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Inserting data from another source
# 1  
Old 04-20-2016
Inserting data from another source

Hi, I am creating a script using Vi to go out on emails. Each email has is own set of attachments, each with a unique number eg Q12343 and Q67897. I have managed to get the script to put in the first attachment customer number ie Q12343, but can't figure out how to get the second one to come in ie Q67897 from the next attachment.
This is the code I have used:
Code:
<td>&nbsp;</td>
<td align='right'><b>Account:&nbsp;&nbsp;</b></td>
<td align='left' colspan='2'>$$CUSTNO</td>

Moderator's Comments:
Mod Comment edit by bakunin: please use CODE-tags for code (-fragments). Thank you.

Last edited by bakunin; 04-21-2016 at 10:04 AM..
# 2  
Old 04-20-2016
The html that you have shown us is the output. What does the input look like.
My first guess would be that you need something like:
Code:
echo "<table>"
while read CUSTNO
#or maybe
for CUSTNO in $list
do
echo "<tr>"
echo "<td>&nbsp;</td>"
echo "<td align='right'><b>Account:&nbsp;&nbsp;</b></td>"
echo "<td align='left' colspan='2'>$$CUSTNO</td>"
echo "</tr>"
done

echo "</table>"

# 3  
Old 04-20-2016
Thanks for your reply, as you probably guess, I'm a total novice at this. Not sure what you mean by my "input". What I have is a program which combines a number of invoices together as attachments, which are going to the same address. The covering email note (which I'm trying to edit) says something like "attached are your invoices". this all works fine and the invoices are all bundled into the correct email for that address.
I want to add a line to the email saying that invoice Q123454 and Q67897 are attached (so that they pick them both up, and or are not left looking for another one they may be expecting). I can get it to pick up the information from the first attachment, but not the second or subsequent ones.
it might be beyond my programing abilities
# 4  
Old 04-21-2016
Quote:
Originally Posted by Cheryl1234
. . . Not sure what you mean by my "input". . .
c.f. thread title: Inserting data from another source
What do you mean by "source" ?
# 5  
Old 04-21-2016
Quote:
Originally Posted by Cheryl1234
What I have is a program which combines a number of invoices together as attachments, which are going to the same address.
How about showing us the program you are trying to change? In general we are better in changing things we do know about than about things we do not.

I hope this helps.

bakunin
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Inserting column data based on category assignment

please help with the following. I have 4 col data .. instrument , category, variable and value. the instruments belong to particular categories and they all measure some variables (var1 and var2 in this example), the last column is the value an instrument outputs for a variable. I have used... (0 Replies)
Discussion started by: ritakadm
0 Replies

2. Shell Programming and Scripting

Inserting data - from one file to another?

Hi Experts, I have a config file (file1) & a data file (file2) : - The file1 I want to modify : to replace "2nd fields c7? & m7? from the data from file2, -The below CPU line fields need to fill by file2's 1st colmns correspoding data. - The below MEM lines to be replaced by... (3 Replies)
Discussion started by: rveri
3 Replies

3. Shell Programming and Scripting

Need help on inserting data from text file to excel using shell script

Hi, Please help me on this. I want to insert data from text file to excel using shell script nawk -v r=4 -v c=4 -v val=$a -F, 'BEGIN{OFS=","}; NR != r; NR == r {$c = val; print}' "file.csv" I used above one to insert $a value in 4th row, 4th column in an excel file.csv and it... (3 Replies)
Discussion started by: suman.frnz
3 Replies

4. Shell Programming and Scripting

Problem with inserting data

Hi, i am doing a simple script to insert logs into particular table through shell script when i run the script, it is inserting null value. Any explanation on this. Here is my script. #!/bin/sh export db_connection_url=apps/apps@VIS ... (2 Replies)
Discussion started by: Rami Reddy
2 Replies

5. Programming

C++ inserting data in a file

Could anyone help me with an efficient(and easy) way to insert data in a file directly(with out using temp file). example open the file1.txt 11112222 333333 44444444 and insert something say " 99999 " somewhere inside the file as 11112222 333 99999 333 44444444 (2 Replies)
Discussion started by: johnbach
2 Replies

6. Shell Programming and Scripting

inserting data into a table from a flat file

Hi, I want to insert data into a table from a flat file, the file is having around 25 columns and some 10,000 records. The columns values are seperated by a space. Thanks (1 Reply)
Discussion started by: ss_ss
1 Replies

7. Shell Programming and Scripting

Help Inserting data in mysql table

Cant understand the error #!/bin/bash temp="" A="" D=$(date +"%Y-%m-%d") H=$(date +"%R") temp=$(wget -q -O - website | grep -o "Temperature:]**" | grep \-E -o "+") mysql -D "weather_wise" -e "INSERT INTO weather (Date, Hour, Degrees) VALUES ($D,$H, $temp)"; my data types for... (11 Replies)
Discussion started by: vadharah
11 Replies

8. Shell Programming and Scripting

Inserting Lines between data sets using SED?

Hello all and thanks in advance! What I'm looking to do is insert a blank line, anytime the first 9 characters of a given line don't match the first 9 characters of the previous line. i.e. Convert the data set 1 45 64 89 1 89 69 235 2 89 234 67 2 56 90... (1 Reply)
Discussion started by: selkirk
1 Replies

9. UNIX for Dummies Questions & Answers

inserting into a data file

Hello I have a unix variable $HDR in a script, which contains header info, and I need to create it as a new line at the top of a data file which is the input $1 in the script. Paul (4 Replies)
Discussion started by: paul1s
4 Replies

10. Shell Programming and Scripting

Inserting a character in a data file

Can some one tell me how I can insert a "|" (pipe) at the 15th column throughout a file? examples: to insert at begining of line i use :g/^/s//\|/ to insert at ene of line i use :g/$/s//\|/ how can i insert at the 15th column position. Thanks in advance (2 Replies)
Discussion started by: jxh461
2 Replies
Login or Register to Ask a Question