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 8757779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:23:06+00:00 2026-06-13T14:23:06+00:00

Okay the answer to this may be really simple but I have been searching

  • 0

Okay the answer to this may be really simple but I have been searching for a while and I can’t figure it out. I have a variable called “tmessagef”. The variable is formatted like:

value1*value2*vlaue3*value4*value5

The only part of the variable I want is value 5. I am currently using the following code but it only prints each value and doesn’t save them to a variable:

OIFS=$IFS
IFS='*'
arr2=$tmessagef
for x in $arr2
do
    echo "$x"
done
IFS=$OIFS

What I want to do is get the 5th line that the echo command produces and save that to a variable called “tmessage”. How would I go about doing this?

Thanks in advance.

  • 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-13T14:23:07+00:00Added an answer on June 13, 2026 at 2:23 pm

    I believe mcalex’s comment should answer it:

    Change echo "$x" to tmessage="$x". At the end of the loop $val will contain the last value

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is probably a really simple answer to this but I just can't see
Okay, this should be really simple, but I have searched all over for the
Okay, I have looked hard for this answer, but all the websites, even the
Okay, this may be a dumb question, but I've not been able to find
Okay this one may be a bit out from left field, but I'm going
Okay, this may be trivial, but I'm hoping somebody can give me a straightforward
Okay, I know this is probably dead simple, but I can't seem to find
okay, this has got to be simple - but I can't seem to find
Okay this question is very simple: I have a facebook page, and a website.
I have been looking all over the Internet for an answer to this question

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.