Print some results in a text file using script in linux

hello everyone,
i really need your help to write a script which would just print following kind of result into a text file (result.txt)

XYZ test Results

ID: <unique-id>                Date: <date>

-------------------------------------------------
| Task         | Result    | Time      |
-------------------------------------------------
| <task1>      | <Result1> | <time1>   |
|              |           |           |
-------------------------------------------------

AD No: <adn>               Generated Date: <tdate>

above all the values of <something> are dynamic or predefined.

Please, kindly help to with this issue... Thanks in advance.

You must show what you have done to solve the problem by your own.
Furthermore, this is the wrong forum for this problem.
Read here

Use printf for the basic formatting, eg somthing like this:

DID=TestID
DDATE=$(date +%Y-%m%d)
DTASK1="Testing"
DRESULT1=OK
DTIME1=$(date +%T)
printf "XYZ test results\n"
printf "\n"
printf "ID: %-20sDate: %s\n" $DID $DDATE
printf "%s\n" "-------------------------------------------------"
printf "|%-14s| %-10s| %-10s |\n" Task Result Time
printf "%s\n" "-------------------------------------------------"
printf "|%-14s| %-10s| %-10s |\n" "$DTASK1" "$RESULT1" "$DTIME1"
printf "%s\n" "-------------------------------------------------"
printf "\n"
printf "AD No: %-20sGenerated Date: %s\n" ADN001 "$(date +%m-%d-%Y)"
1 Like

Thank you so much for this idea.. OMG i can't believe it was that simple... :smiley:

Again thank you so much for your response...