Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8698853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:48:51+00:00 2026-06-13T01:48:51+00:00

The command elb-describe-instance-health returns the following INSTANCE_ID i-111 INSTANCE_ID i-222 INSTANCE_ID i-333 $(elb-describe-instance-health |

  • 0

The command elb-describe-instance-health returns the following

INSTANCE_ID  i-111
INSTANCE_ID  i-222
INSTANCE_ID  i-333

$(elb-describe-instance-health | awk '/INSTANCE_ID/{print $2}')

returns i-111 i-222 i-3333

How can I change the above syntax to store each of these values in an array (ex. foo[0] equals i-111, foo[1] equals i-222, foo[2] equals i-333?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:48:52+00:00Added an answer on June 13, 2026 at 1:48 am

    Here’s one way:

    array=($(elb-describe-instance-health | awk '/INSTANCE_ID/ { print $2 }'))
    

    Then simply echo the element you want. To echo the first element for example, try:

    echo "${array[0]}"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This command gives me the following output: cat /proc/net/dev | awk '{print $1}' Inter-|
What command can I use to print out the commit id of HEAD? This
swap command : /usr/sbin/swap -s I even tried something like awk '/total/ {print $2}'
Following command will let me know the names of databases. $ mysqlshow But how
The command to remove a remote branch in git is the following git push
The command: awk –f cs2ss.awk < dataset.csv > dataset.ss should be using this program:
this command is really very useful but where I can get the source code
What command can I put at the end of a batch file to prevent
invalid command-line parameter: ..\Documents\android-sdk-windows\tools/emulator-arm.exe. Any idea how can I solve that problem?
Following command giving me current month (March) in short form. SELECT left(datename(month, getdate()), 3)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.