Storing UNIX shell command output to a new sheet in excel

I am not finding a way to store output of unix shell script to a new spreadsheet in an existing excel file.
Also the shell script that I have written should be called from a macro in excel . The shell script that I have written is as follow :

git ls-files | grep '\.java$' | xargs wc -l | awk ' BEGIN {printf( "%5s\n", "Count\tPath")} { printf ("%6s\n", $1 "\t" $2 )}' > result.xls

I need to call the macro from new.xlsm file and once the shell script is executed the output is expected to be saved in a new spreadsheet of the same new.xlsm excel sheet. Instead it creates a new excel file itself.
Thanks in Advance

Hi and welcome to the forums

For next time, please use code tags for easier reading.

2 important points.

1) Shell scripts are plaintext, XLS is not, you might want to check out CSV files for better usability.
2) Shell redirection works as follow: > =Create/Overwrite ;; >> =Append

Also, you might need to 'work' on the output you've created so far, it's not spreadsheet conform yet.

You're currently trying to combine 2 different worlds... Linux & MS.

For proper XLS file support, go with VBA.
For proper shell support, go with a CSV sheet.

Because AFAIK, it's not possible (read: even IF ; it would need tons of tweaking) to access//write XLS files (this 'SPECIFIC' file format, because its BINARY) from any regular *nix based shell.
Please correct me if I'm wrong on this.

Hope this helps, allthough not what you wanted.