[SOLVED] Mutipule .xls files convert into single .csv
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
For example you might want to use this for a
real comma-separated document:
-i 44,34,utf-8,2,1/5/2/1/3/1/4/1
which will
use a comma (44) as the field separator,
a double quote (34) as the text delimiter,
UTF-8 for the input encoding,
start from the second row
and use the specified formats for each column (1 means standard, 5 means YY/MM/DD date)
You could use --stdout and pipe the output into awk:
Code:
unoconv ... --stdout | awk 'NR>6' > out1.csv
then cat the three files
Code:
cat out[123].csv >out.csv
I don't know what you mean by "single shot".
how to capture files name list which are involved in below command? I mean how many files are converted from .xls to CSV , I have to capture those file names into .txt file? Does it possible?
how to capture files name list which are involved in below command? I mean how many files are converted from .xls to CSV , I have to capture those file names into .txt file? Does it possible?
and did you replace /path/to/incomingDir/ with correct dir?
Finally, I am able to convert all .xls file into single .csv. Everything looks good. Now, I just want to see what are the files are converted using this command. Just for audit purpose. How to inject the audit log in this code?
for input in test_amount*.xls; do
unoconv -f csv -e FilterOptions="59" --stdout $input
done > test_data.csv
Ex: If this code 10 files converted to .csv then I have to capture and store the all 10 files name into one .log file.
Last edited by satyarankireddy; 09-22-2019 at 11:20 AM.
Finally, I am able to convert all .xls file into single .csv. Everything looks good. Now, I just want to see what are the files are converted using this command. Just for audit purpose. How to inject the audit log in this code?
Code:
for input in test_amount*.xls; do
unoconv -f csv -e FilterOptions="59,0,0,1" --stdout $input | tail -n +6
done > test_data.csv
Ex: If this code 10 files converted to .csv then I have to capture and store the all 10 files name into one .log file.
why are you skipping line 1 and then skipping 6 lines ?
do you want to ignore the first 7 rows?
edit you are starting at row 1, then dropping 6
why not start at 7?
why are you skipping line 1 and then skipping 6 lines ?
do you want to ignore the first 7 rows?
the code was skipping first 6 rows for each file and converted to single .csv file. It is working fine as expected. Now, I want to capture files names into single .log file for audit purpose.
Do you have any idea ?
Last edited by satyarankireddy; 09-22-2019 at 11:00 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.