Ezhilan Mahalingam
Ezhilan Mahalingam

Reputation: 3330

print values at fixed position in Terminal window using UNIX

I am running a shell script which produces below output.

Built-By : apache

Created-By : Apache Maven

Implementation-Title : testApp

Implementation-Vendor-Id : com.test.app

Implementation-Version : testBox

Manifest-Version : 1.0

appname : TestStar

build-date : 02-03-2014-13 : 41

version : testBox

Expecting the below output: (Please ignore _ underscore)

Built-By_________________: apache

Created-By_______________: Apache Maven

Implementation-Title_____: testApp

Implementation-Vendor-Id_: com.test.app

Implementation-Version___: testBox

Manifest-Version_________: 1.0

appname__________________: TestStar

build-date_______________: 02-03-2014-13 : 41

version__________________: testBox

Someone Please help me. I am iterating two arrays to print these values.

Upvotes: 0

Views: 708

Answers (1)

songhir
songhir

Reputation: 3583

show me your code.

maybe this would help:

#!/bin/bash key=("appname" "version" "Created-By") value=("TestStar" "testBox" "Apache Maven") for i in "${!key[@]}";do printf "%-15s %s\n" "${key[i]}" "${value[i]}" done

Upvotes: 1

Related Questions