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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:59:12+00:00 2026-05-15T04:59:12+00:00

What is the bug in the following script? #! /bin/tcsh -f cut -d -f2

  • 0

What is the bug in the following script?

#! /bin/tcsh -f
cut -d" " -f2 ${1} | ./rankHelper

Script rankHelper:

#! /bin/tcsh -f
set line = ($<)
while(${#line} != 0)
cat $line
set line = ($<)
end

File lines from which the data was sent:

053-3787837 038280083
052-3436363 012345678 
053-3232287 038280083 
054-3923898 033333333 
052-2222333 012345678 
052-1111111 012390387 

I run it using:

> ./rank lines

Why do I receive only the following one number?

038280083

I thought cut must cut two fields from all rows. I expect to see the second field from all rows from the lines:

dos2unix: converting file rank to UNIX format ...
 > ./rank lines
 > 

 > cat -A rank
#! /bin/tcsh -f$
cut -d" " -f2 ${1} | ./rankHelper


> cat -A rankHelper
#! /bin/tcsh -f$
set line = ($<)$
$
$
while(${#line} != 0)$
$
echo $line$
set line = ($<)$
end

I’m working on C shell.

  • 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-05-15T04:59:13+00:00Added an answer on May 15, 2026 at 4:59 am

    I changed rank to this:

    #! /bin/tcsh -f
    cut -d" " -f2 ${1}
    

    and ran

    > ./rank lines
    

    and it worked for me.

    Edit: If you still want to use rankHelper for some reason (homework?), try changing, in rankHelper the command

    cat $line
    

    to

    echo $line
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following causes a bug because file.eof() apparently doesn't return true until a read
The following DOS script snippet has a bug: if not exist %MyFolder% ( mkdir
I'm running a node script from the command line on Windows and am trying
I created a small script I use for 'cleaning' sitemap file from certain links.
I'm trying to run the following line of script in bash on Mac OS
I got nabbed by the following bug again and would like some clarification to
I've been grinding my teeth on the following bug: I am defining a few
I am developing a raid system and I am getting following BUG when I
I am working through a bug. In recreating the bug for the following sample
There's a bug in my app which shows up with the following (partial) stacktrace:

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.