Skip to main content
deleted 294 characters in body
Source Link
Gilles Quénot
  • 182k
  • 42
  • 228
  • 228

One solution using a while loop and tput :

while IFS=$'\t' read -r c1 c2 c3; do
    tput setaf 1; printf "$c1\t"
    tput setaf 2; printf "$c2\t"
    tput setaf 3; printf "$c3\t"
    tput sgr0; echo
done < file

enter image description here

AnotherA solution using printf to format the ouput as well :

while IFS=$'\t' read -r c1 c2 c3; do
    tput setaf 1; printf '%-10s' "$c1"
    tput setaf 2; printf '%-30s' "$c2"
    tput setaf 3; printf '%-30s' "$c3"
    tput sgr0; echo
done < file

enter image description here

One solution using a while loop and tput :

while IFS=$'\t' read -r c1 c2 c3; do
    tput setaf 1; printf "$c1\t"
    tput setaf 2; printf "$c2\t"
    tput setaf 3; printf "$c3\t"
    tput sgr0; echo
done < file

enter image description here

Another solution using printf to format the ouput as well :

while IFS=$'\t' read -r c1 c2 c3; do
    tput setaf 1; printf '%-10s' "$c1"
    tput setaf 2; printf '%-30s' "$c2"
    tput setaf 3; printf '%-30s' "$c3"
    tput sgr0; echo
done < file

enter image description here

A solution using printf to format the ouput as well :

while IFS=$'\t' read -r c1 c2 c3; do
    tput setaf 1; printf '%-10s' "$c1"
    tput setaf 2; printf '%-30s' "$c2"
    tput setaf 3; printf '%-30s' "$c3"
    tput sgr0; echo
done < file

enter image description here

added 364 characters in body
Source Link
Gilles Quénot
  • 182k
  • 42
  • 228
  • 228

One solution using a while loop and tput :

while IFS=$'\t' read -r c1 c2 c3; do
    tput setaf 1; printf "$c1\t"
    tput setaf 2; printf "$c2\t"
    tput setaf 3; printf "$c3\t"
    tput sgr0; echo
done < file

enter image description here

Another solution using printf to format the ouput as well :

while IFS=$'\t' read -r c1 c2 c3; do
    tput setaf 1; printf '%-10s' "$c1"
    tput setaf 2; printf '%-30s' "$c2"
    tput setaf 3; printf '%-30s' "$c3"
    tput sgr0; echo
done < file

enter image description here

One solution using a while loop and tput :

while IFS=$'\t' read -r c1 c2 c3; do
    tput setaf 1; printf "$c1\t"
    tput setaf 2; printf "$c2\t"
    tput setaf 3; printf "$c3\t"
    tput sgr0; echo
done < file

enter image description here

One solution using a while loop and tput :

while IFS=$'\t' read -r c1 c2 c3; do
    tput setaf 1; printf "$c1\t"
    tput setaf 2; printf "$c2\t"
    tput setaf 3; printf "$c3\t"
    tput sgr0; echo
done < file

enter image description here

Another solution using printf to format the ouput as well :

while IFS=$'\t' read -r c1 c2 c3; do
    tput setaf 1; printf '%-10s' "$c1"
    tput setaf 2; printf '%-30s' "$c2"
    tput setaf 3; printf '%-30s' "$c3"
    tput sgr0; echo
done < file

enter image description here

Source Link
Gilles Quénot
  • 182k
  • 42
  • 228
  • 228

One solution using a while loop and tput :

while IFS=$'\t' read -r c1 c2 c3; do
    tput setaf 1; printf "$c1\t"
    tput setaf 2; printf "$c2\t"
    tput setaf 3; printf "$c3\t"
    tput sgr0; echo
done < file

enter image description here