Sample Header Ad - 728x90

"Cannot reallocate" when create file?

1 vote
1 answer
1553 views
I am trying to create excel sheet based on multiple files on a root. I read files line by line and append in the final excel sheet. I am trying this shell script on small files and it worked 100%, but when I try it on the needed files (85MB per each file) I get this error: (dsadm@DEVDS) /EDWH/XML/Must # XML.sh csv excel_outputfilename ./XML.sh: line 41: fallocate: command not found ./XML.sh: xmalloc: cannot allocate 172035663 bytes (0 bytes allocated) ./XML.sh: xrealloc: cannot reallocate 86013568 bytes (0 bytes allocated) ./XML.sh: xrealloc: cannot reallocate 86021888 bytes (0 bytes allocated) Note: - The csv parameter is the file extension - My OS and version: Unix AIX 7.1 Here's the script: #!/usr/bin/bash #Files Extension# Ext=$1 #OutPut File Name without extension ex: TEST# OutPutFileName=$2.xls function XMLHeader () { echo " " } function SheetHeader () { echo " " } function SheetFooter () { echo " " } function XMLFooter () { echo "" } #################################################################################### cd /EDWH/Samir/XML/Must; fallocate -l 1G $OutPutFileName XMLHeader > $OutPutFileName; # loop on the exists files to build Worksheet per each file for Vfile in $(ls | grep .$Ext); do echo "" >> $OutPutFileName ### loop to write the Row VarRow=cat $Vfile for Row in $(echo $VarRow ) do echo "" >> $OutPutFileName ### loop to write the cells VarCell=echo $VarRow for Cell in $(echo $VarCell | sed "s/,/ /g") do echo "$Cell" >> $OutPutFileName done echo "" >> $OutPutFileName done echo "" >> $OutPutFileName done echo "" >> $OutPutFileName #################################################################################### exit;
Asked by Ahmed Samir (23 rep)
Nov 19, 2015, 09:59 AM
Last activity: Jul 23, 2022, 06:02 AM