I have some text files in a folder. The names can be like:
emp.txt
emp1.txt
emp3.txt
32emp4.txt
What i need is i have to copy all the files which have "emp" string in their filename
to a different folder and those file names should be appended by "date and timestamp" before the .txt
Can any one tell a shell script for this?
Example
All the above txt files should be renamed as
emp"Date and TimeStamp".txt
emp1"Date and TimeStamp".txt
emp3"Date and TimeStamp".txt
32emp4"Date and TimeStamp".txt
I have 5 files in a directory.
emp1_usage.txt
emp2_usage.txt
emp3_usage.txt
emp4_usage.txt
emp5_usage.txt
I am using sqlldr to get the contents of the above 5 files and store it in a temp table and update my original table using temp table.
for f in \*emp*.txt
do
sqlldr usr/passwd control=data.ctl data=$f
done
Now, the problem i got is:
I have a table called 'emdc' in which one column has the values:
emp_name
------------
emp1
emp2
emp3
I should dynamically check what are the values in the emdc table and pass to the sqlldr those file-names which have the values in the emdc table.
Let me explain Clearly:
I should now process only emp1_usage.txt, emp2_usage.txt, emp3_usage.txt into the sqlloader.
The script should automatically check for the values in emdc table and process only the 3 files among the 5 files present in the directory.