Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing from one file into another

Status
Not open for further replies.

Jalr2003

Technical User
May 15, 2003
26
0
0
US
Hi,

I imagine this is a trivial question for you.

I am writing a ksh script that prompts the user to enter several IDs and then stores it into a file, so the list can be used within a sql statement.

the file looks like this:

--- File 1 ----
'12323kkk',
'teerkkwe',
'445kksk3',
'sdfdkkkk'
---------------
The sql statament in which I would like to insert this list looks like this:

--- File 2 ----

Select
field 1,
field 2
from
table
where
value in (
********
)
/
-------------------

The idea is to replace the eight asterisks in File 2 with the list from file one.

I am not sure what is the simplest option here: sed, awk?

Do you have any suggestions?

Thanks beferehand for your help,

Jalr2003
 
Look at faq822-2218 for starters.
And please provide the following ( if you still need help)
Which DB are you working with ?
What unix server ?
Which unix shell ?



Dickie Bird (:)-)))
 
something like this should get you started:

sed -e &quot;s/[*][*]*/$(tr -d '\n' < File1.txt)/g&quot; File2.txt

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top