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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:09:36+00:00 2026-06-16T23:09:36+00:00

i have a variable $x having a sample values like isd21anms.com, isd31anms.com etc. Now

  • 0

i have a variable $x having a sample values like isd21anms.com, isd31anms.com etc. Now i want to iterate through for loop to change the no 1 from 1 through 1,2,3 4. Please look below code

for i in 1 2 3 4
do
     change $i such that I get values isd21anms.com, isd22anms.com, isd23anms.com, isd24anms.com
done

remember $x can have values like isd21anms.com, isd31anms.com, isd41anms.com. So i have to save it in variable and apply for loop on it instead of using a constant value.

  • 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-16T23:09:37+00:00Added an answer on June 16, 2026 at 11:09 pm
    for i in 1 2 3 4
    do
    y=`echo $temp | sed "s/\(.*\).\(anms.com\)/\1"${i}"\2/g"`
    echo "y is $y"
    done
    

    tested below:

    > ./temp.sh
    y is isd21anms.com
    y is isd22anms.com
    y is isd23anms.com
    y is isd24anms.com
    > setenv temp "isd31anms.com"
    > ./temp.sh
    y is isd31anms.com
    y is isd32anms.com
    y is isd33anms.com
    y is isd34anms.com
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a _bstr_t variable bstrErr and I am having a CString variable csError
I'm having a problem relating to storing a variable within Javascript. I have a
I am having this issue. I have a script that checks if variable exists,
I have variable which I populate from JSON formated data. Something like: var time=my_data[data.results[i].id].time;
I have variable @count of datatype int.I am setting values to this @count. I
I have a Java program performing some large analysis tasks, running through a loop
I have read in various places that having variables with global scope, i.e. a
I have acquired the habit of declaring reused variables outside loops from having worked
I'm essentially having difficulty pass dynamic variables to a view. I have php functions
I have variable in the parent document eg. $var = 'blah'; Then a div

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.