Create excel file using bash script

i have written one script which generates text file which gives output like.

001.config: CR1.1       COMPILE_PASSED           TEST_PASSED
002.config: CR1.1        COMPILE_FAILED            TEST_FAILED
.
.
.so on

this text file will get filled one by one as its for loop for n number.

i want to create excel file which should contain four columns which takes input from above text file. it should look like

____________________________________________________
test id         Release        compilestatus        executionstatus
_____________________________________________________ 
001.config:   CR1.1       COMPILE_PASSED         TEST_PASSED
002.config:   CR1.1        COMPILE_FAILED          TEST_FAILED

so we can fill excel one by one as text file is getting filled as per script exceution or at the end we can take all completed text file and just do copy paste from text file to excel.

can nybody please tell me how to do this task using shell script

For bash, I believe the best you could do is to create a CSV file.
If you could do it in perl, making an excel file is possible.

Have your first script writing ";" between the values.
Then all you need to do is open it in excel as cvs.

Should have figured in other post as well.

Hi my first script which is generating text file which doenst have ; between the values. i have just inserted spaces to separete the output values.

first time i am trying to genarate .csv file so i dont know how to name columns and appropriate data in those columns.

Thanks to reply if you know this.

---------- Post updated at 02:03 PM ---------- Previous update was at 02:02 PM ----------

Hi,
.csv is ok for me.

Can you please tell me how do this task??

When you generate the 'rawfile', merley instead of putting spaces as seperator, you use ";" straight.
Each ";" defines a new 'field', so you can use "test id" ; "other value" and so on for the title, and val1 ; val2 ; val3 ; val4 for the following values.

If you're willing to share that script, we could help better.

Hi,

i have attached some part of script 'script.txt' raw file generated by script. i have used your code to generate .csv file . csv file contains below output.
FC/B_096.config ; FR2.0 ; COMPILE_PASSED ; TEST_FAILEDFC/B_019.config ; FR2.0 ; COMPILE_PASSED ;TEST_PASSED

so we need to convert this .csv file to excel format and why column names are not coming in .csv file??
thanks

if [ $errstat -ne 0 ]; then 
( 
    echo "FC/$i  $FRRELEASE  COMPILE_FAILED  TEST_FAILED" 
) >> $SPECIALLOGDIR/$RESULTFILE

Becomes:

if [ $errstat -ne 0 ]; then 
( 
    echo "FC/$i ; $FRRELEASE ; COMPILE_FAILED ; TEST_FAILED" 
) >> $SPECIALLOGDIR/$RESULTFILE

AND

if [ $RESULT -eq 0 ]; then 
    echo "FC/$i  $FRRELEASE  COMPILE_PASSED  TEST_PASSED"; 
elif [ $RESULT -eq 1 ]; then 
    echo "FC/$i  $FRRELEASE  COMPILE_PASSED  TEST_FAILED"; 
else [ $RESULT -eq 2 ]; 
      echo "FC/$i  $FRRELEASE  COMPILE_PASSED  TEST_FAILED_UNKNOWN_BREAKPOINT"     
fi

Becomes:

if [ $RESULT -eq 0 ]; then 
    echo "FC/$i ; $FRRELEASE ; COMPILE_PASSED ; TEST_PASSED"; 
elif [ $RESULT -eq 1 ]; then 
   echo "FC/$i ; $FRRELEASE ; COMPILE_PASSED ; TEST_FAILED"; 
else [ $RESULT -eq 2 ]; 
    echo "FC/$i ; $FRRELEASE ; COMPILE_PASSED ; TEST_FAILED_UNKNOWN_BREAKPOINT"     
fi

hth

No double posting or bumping! thread closed
Continue here: