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

  • Home
  • SEARCH
  • 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 8249611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:36:18+00:00 2026-06-07T23:36:18+00:00

Basically I am trying to read information from three text files in which it

  • 0

Basically I am trying to read information from three text files in which it contains unique information.

The way the text file is setup is this:

textA.txt
----------------
something.awesome.com
something2.awesome.com
something3.awesome.com
...

textB.txt
----------------
123
456
789
...

textC.txt
----------------
12.345.678.909
87.65.432.1
102.254.326.12
....

Now what its suppose to look like when i output it something like this

something.awesome.com : 123 : 12.345.678.909
something2.awesome.com : 456 : 87.65.432.1
something3.awesome.com : 789 : 102.254.326.12

The code I am trying now is this:

for each in `cat site.txt` ; do
    site=`echo $each | cut -f1`

    for line in `cat port.txt` ; do
        port=`echo $line | cut -f1`

        for this in `cat ip.txt` ; do
            connect=`echo $this | cut -f1`

            echo "$site : $port : $connect"
        done
    done
done

The result I am getting is just crazy wrong and just not what i want. I don’t know how to fix this.

I want to be able to call the information through variable form.

  • 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-07T23:36:19+00:00Added an answer on June 7, 2026 at 11:36 pm
    paste testA.txt testB.txt testC.txt | sed -e 's/\t/ : /g'
    

    Output is:

    something.awesome.com : 123 : 12.345.678.909
    something2.awesome.com : 456 : 87.65.432.1
    something3.awesome.com : 789 : 102.254.326.12
    

    Edit: Here is a solution using pure bash:

    #!/bin/bash                                                                                                                         
    
    exec 7<testA.txt
    exec 8<testB.txt
    exec 9<testC.txt
    
    while true
    do
        read site <&7
        read port <&8
        read connect <&9
    
        [ -z "$site" ] && break
    
        echo "$site : $port : $connect"
    done
    
    exec 7>&-
    exec 8>&-
    exec 9>&-
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to read from file: The file is multiline and basically i
I'm trying to get some information from this tutorial: http://m.onkey.org/2008/11/18/ruby-on-rack-2-rack-builder basically I want to
I'm trying to basically trying to separate a specific amount of text from the
I'm basically trying to extract a Mac application from a zip file using QuaZip.
I was trying to scrape some information from a website page by page, basically
I am basically trying to return from a method which reads user input from
This is basically what I am trying to do. I wanna take a File
I'm trying to read weather information from the Google Weather API. My Code looks
I am trying to write the below information to a csv file in this
I'm basically trying to make my js and css files dynamic. I've tried a

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.