Greetings.
I have files that contains eleven fields in the file name. Each file has a specific meaning. My job is to list each file name and load the info into a database table for reporting.
My awk code does this (files have VER suffix):
find . -name "*.VER" -exec ls '{}' ';' -printf %f\\t | awk -F"~" '{print $1"\t"$2"\t"$3"\t"$4"\t"$5"\t"$6"\t"$7"\t"$8"\t"$9"\t"$10"\t"$0}' > somefile.tab
It works fine except that it does something weird with the file name ($0): it repeats it like so (the 2 last fields from the right):
RRR1 PRE DTV_PREP PREP05 JGM15453. 26 P H23-600 029416589165 20110216 RRR1~PRE~DTV_PREP~PREP05~JGM15453.~26~P~H23-600~029416589165~20110216~090353.VER ./RRR1~PRE~DTV_PREP~PREP05~JGMDTV269~33~P~H21-200~029384120357~20110216~091829.VER
What am missing here? Any ideas?
Thanks for your input.
---------- Post updated at 12:25 PM ---------- Previous update was at 12:11 PM ----------
I removed " -printf %f\\t " and replaced $0 with $filename. It works now but display "./" right before the filename. How can remove these two leading characters?