Print out onto same line with ":" separating variables

Chris Kerr

I have the following piece of code and would like to display HOST and RESULT side by side with a : separating them.

HOST=`grep pers results.txt | cut -d':' -f2 | awk '{print $1}'`
RESULT=`grep cleanup results.txt | cut -d':' -f2 | awk '{print $1}' | sed -e 's/K/000/' -'s/M/000000/'`
echo ${HOST}${RESULT}

Please can anyone assist with the final command to display these, I am just getting all of hosts and then all of results.

Radu Rădeanu

You probably want this:

HOST=( `grep pers results.txt | cut -d':' -f2 | awk '{ print $1 }'` ) #keep the output of the command in an array
RESULT=( `grep cleanup results.txt | cut -d':' -f2 | awk '{ print $1 }' | sed -e 's/K/000/' -'s/M/000000/'` )
for i in "${!HOST[@]}"; do
    echo "${HOST[$i]}:${RESULT[$i]}"
done

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Print multiple ruby variables on the same line

From Dev

How to print out to the same line, overriding previous line?

From Dev

Print array separating values in groups with same substring

From Dev

Printing out multiple variables within the same print statement

From Dev

Printing out multiple variables within the same print statement

From Dev

Printing on the same line in DrJava using System.Out.Print

From Dev

Print a range of lines onto one line in awk

From Dev

Align pieces of text onto the same line

From Dev

Print output on the same line

From Dev

same line print in c

From Dev

Print output on the same line

From Dev

BeautifulSoup Python printing out the extracted data from a table the 2nd column is dropping onto a new line. How ot keep it on same line

From Dev

BeautifulSoup Python printing out the extracted data from a table the 2nd column is dropping onto a new line. How ot keep it on same line

From Dev

IntelliJ - print out variables for debugging?

From Dev

Print out a new line in java

From Dev

Print out certain line of file

From Dev

Sed to print out the line number

From Dev

Print two variables in one line

From Dev

Printing with Java, how to mix "%.2f", variables, and regular strings on same print line?

From Dev

Python: for loop - print on the same line

From Dev

Multiple awk to print in the same line

From Dev

Python: for loop - print on the same line

From Dev

linux + print the values in the same line

From Dev

bash displays print on the same line

From Dev

awk print output on same line

From Dev

Print awk output on the same line

From Dev

Read something in the same print line

From Dev

'print' command in Python (print in the same line)

From Dev

How to print a line and type input in the same line

Related Related

  1. 1

    Print multiple ruby variables on the same line

  2. 2

    How to print out to the same line, overriding previous line?

  3. 3

    Print array separating values in groups with same substring

  4. 4

    Printing out multiple variables within the same print statement

  5. 5

    Printing out multiple variables within the same print statement

  6. 6

    Printing on the same line in DrJava using System.Out.Print

  7. 7

    Print a range of lines onto one line in awk

  8. 8

    Align pieces of text onto the same line

  9. 9

    Print output on the same line

  10. 10

    same line print in c

  11. 11

    Print output on the same line

  12. 12

    BeautifulSoup Python printing out the extracted data from a table the 2nd column is dropping onto a new line. How ot keep it on same line

  13. 13

    BeautifulSoup Python printing out the extracted data from a table the 2nd column is dropping onto a new line. How ot keep it on same line

  14. 14

    IntelliJ - print out variables for debugging?

  15. 15

    Print out a new line in java

  16. 16

    Print out certain line of file

  17. 17

    Sed to print out the line number

  18. 18

    Print two variables in one line

  19. 19

    Printing with Java, how to mix "%.2f", variables, and regular strings on same print line?

  20. 20

    Python: for loop - print on the same line

  21. 21

    Multiple awk to print in the same line

  22. 22

    Python: for loop - print on the same line

  23. 23

    linux + print the values in the same line

  24. 24

    bash displays print on the same line

  25. 25

    awk print output on same line

  26. 26

    Print awk output on the same line

  27. 27

    Read something in the same print line

  28. 28

    'print' command in Python (print in the same line)

  29. 29

    How to print a line and type input in the same line

HotTag

Archive