I have to call a SQL query from bash that outputs 1000 rows of two columns
- File_Path (Eg.,
/opt/files/dest/2.bin
) - Name_of_the_file (Eg.,
fax attachment.pdf
,invoice.docx
... yes, there are spaces).
The file name in the server file system is in different naming format eg: 1.bin, 22.bin. There are <1000 unique files exactly as some are missing.
Here is the Snapshot of the SQL query:
Select * from datafileinfo limit 4;
Output:
FILEID,NAME
/ran/file/MM/2012/04/3.bin,new_fax.pdf
/ran/file/MM/2013/06/12.bin,new_report.docx
/ran/file/MISC/2012/08/212.bin,daily_transact.jrxml
/ran/file/MONY/2013/04/122.bin,NULL
As a first step, I gathered all those files and put it in a temporary folder.
But I couldn't able to rename the files as I have to lookup the 'Name of the file' with corresponding 'File Path'. Is there any way I can perform the job?