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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking a Flat File 1

Status
Not open for further replies.

longs

Programmer
Jul 27, 2007
31
0
0
US
HI All

I have a fixed length flat file. I want the records in the flat file to be loaded to two different database tables based on a condition, before that I have to create two file out of one file.

Let me give you an example;
01082008011300046coffee 46
02602008011987456phone 56
01652008020145123packet 09

store-1:4
date- 5:12
bar_code-13:17
item-18:24
dept-25:26

i would like to check bar_code if its less than 99 and equal to dept then i will go to file1(that file1 will be loaded to table1)
if not then file2(loaded to table2)

How can i print character 13 to 17 and then check if its less then 99 and then compare to dept(which is 25:26)
 
Excuse my suspicious mind but this looks to me like a student posting. However I'm feeling kind so, for a starting point, look at 'cut' Try
Code:
man cut
and look at the -c flag.

On the internet no one knows you're a dog

Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top