Suppose mt table
name is Table_1
Structure of the table is something like:
EMP_id, Emp_Name, File_Name_Input_Date (columns)
I am loading Table_1
from a CSV file. The name of this CSV file is daily_01122014.csv
I am using vertical copy command to load this table:
ex copy Table_1 from '/location/daily_01122014.csv'delimiter ',';
It will load the table, but column name File_Name_Input_Date
will be left blank, and I have to hard code it.
What I want is to write a shell script which will dynamically read file name and load it into column File_Name
, and also extract date from file name.
i.e: If file name is daily_01122014.csv
, then while loading Table_1
column File_Name
should be daily_01122014.csv
and Input_Date
should be 2014-12-01
. Since I have 50-60 files, I can not do it manually.