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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:27:36+00:00 2026-06-04T08:27:36+00:00

I have a list of data that I need to analyze. The first thing

  • 0

I have a list of data that I need to analyze. The first thing I do is check whether the file is indeed the one I want, then I sort the data according to the 4th column, and then I need to manually order the sorted line.

For example, I need to print the 3rd word in the line, and then the first word etc.
Here is what I wrote:
mainScript :

#!/bin/bash
for file in `ls ${1}` ; do
    if [[ ! ($file = *.user) ]] ; then
        continue
    fi

    sort -nrk4 $file | source printer_script

done

printer_script :

#!/bin/bash
echo $3
echo $1
echo $2

Why nothing gets printed even though I send the sorted lines by pipeline?

  • 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-04T08:27:38+00:00Added an answer on June 4, 2026 at 8:27 am

    Because with the pipe the output of sort goes to the standard input of your script, and in it instead you are looking at the parameters; if you want to grab that output and pass it as parameters, you should do:

    ./printer_script $(sort -nrk4 $file) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a long list of data that I want to display in table
I have a list of data points (0.2, 0.8, 0.95) that I want to
I need to have a large list of data that when referenced at a
I have a list of data need to be grouped, but we only want
I have a list of data that I need to display in a web
I have a list of data sets that need to be updated real time.
I have a whole list of data that I need to replace some data
I have a list of data that is a schedule. Each item has a
I have a list of data in javascript that looks like this: [[152, 48,
I have a generic linked-list that holds data of type void* I am trying

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.