Reputation: 971
I am trying to use find exec like this
find . -name '*xlsx' -exec xlsx2csv-2.7 -i --skipemptycolumns
The problem is that xlsx2csv needs two parameters at the end, input file name and output file name.
I have a bunch of files 1.xlsx, 2.xlsx and so on that I want to convert to CSV and name 1.csv, 2.csv...
Basically I need to run the following commands
xlsx2csv-2.7 -i --skipemptycolumns 1.xlsx 1.csv
xlsx2csv-2.7 -i --skipemptycolumns 2.xlsx 2.csv
Can this be done using find exec? If not, are there other better solutions?
Upvotes: 0
Views: 103
Reputation: 937
You can do it like this:
find -name '*.xslx' -exec sh -c 'xlsx2csv-2.7 -i --skipemptycolumns {} `echo {} | sed 's/\.xlsx/\.csv/'`' \;
Upvotes: 1