On Request from one of our reader here is a post to convert excel files into a comma delimeted file.
create shell script using following code. The script below will fetch all files with extension xls and convert tabs into comma and create a .csv file.
cd /applmgr/custom/inbound/data
for i in *.xls
do
echo $i
newfile=$i.csv
awk 'BEGIN {
FS = "\t"
OFS = ","
}
{
$1 = $1
for (i = 1; i <= NF; i++) {
if ($i == "") {
$i = "null"
}
}
print $0
}' $i > $newfile
done
0 Comments:
Post a Comment