Dear Unix gurus,
I have to solve the following types of problem - which I'm hoping can
be solved more efficiently than my crude and inefficient ways of
solving. Basically I have lists in the order 20,000 records which I
need to run a SQL query involving 'WHERE' clause. My files/environment
is a Sun (OS 5.6) unix box.
SQL 'WHERE' clause can only accept 1000 records at a time - hence, I
need to split the list in individual files of 1000 records each.
Here is a sample input file - its a list, so each record is separated
by a new line character and there are no duplicates in the list.
When I use the split command as shown below
split -1000 InputFile
The resulting files get named as
question 1: how can I make the starting and ending line numbers appear
in the resulting output files. For example
if my Input file name is InputFile and has 20000 records, I would like
the resulting Output files named as
Upon running the split command, I now have 20 output files - each has
1000 records. I need to insert some text in each output file so to
convert them to .sql files. When I run the split command, the
resulting xaa, xab..etc files will obviously be in the same directory?
question - can anyone show me how to do this. An illustration is
xaa (sample file)
xaa.sql (resulting .sql file)
SELECT PART_NUMBER '|' DESCRIPTION FROM PARTS_TABLE where PART_NUMBER