Ok, I am fairly new at Unix scripting, but have been a programmer for years. I have a project I am spinning my wheels on right now.
Here is the job, I have a directory full of files. There are 5 types of files in this directory, all of them are tab delimited text files for a database. they follow a format: fileType_date_location.
I have made a stored procedure for each file to load the data from the file into the db.
What I need to do is use a script to basically get a list of all the files in the directory, then go file by file, determine what kind of file it is, trim the top 2 lines off the file, and then call the correct stored procedure (via command line) based off of the file type. After all the files have been looped through I need to clear out the directory.
I have tried making a variable with the number of files in the directory (ls | wc -l) and then loop through each file .. but im not really sure how to progress. If anyone has any ideas or some approaches to think about that would be much appreciated.
Here is the job, I have a directory full of files. There are 5 types of files in this directory, all of them are tab delimited text files for a database. they follow a format: fileType_date_location.
I have made a stored procedure for each file to load the data from the file into the db.
What I need to do is use a script to basically get a list of all the files in the directory, then go file by file, determine what kind of file it is, trim the top 2 lines off the file, and then call the correct stored procedure (via command line) based off of the file type. After all the files have been looped through I need to clear out the directory.
I have tried making a variable with the number of files in the directory (ls | wc -l) and then loop through each file .. but im not really sure how to progress. If anyone has any ideas or some approaches to think about that would be much appreciated.