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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:57:41+00:00 2026-05-29T05:57:41+00:00

I am migrating a legacy bash script which runs inside a www server. I

  • 0

I am migrating a legacy bash script which runs inside a www server. I have came across an issue that I am not able to explain.

When ran through the webserver (as a CGI included script), the following commands:

#!/bin/bash
set -e -u
echo "BP: Statistics generation 1" >/dev/fd/2
echo "BP: one: $1, two: $2" >/dev/fd/2

more ../download/interactions.$1.$2 | grep -v "#" | awk '($2!~/_R/){print $2}' | sort -k 1 | uniq > rna.names.txt
more ../download/interactions.$1.$2 | grep -v "#" | awk '($1!~/_R/){print $1}' | sort -k 1 | uniq > protein.names.txt

The protein.names.txt looks like:

../download/interactions.3424.asdfjj
507-558_1
::::::::::::::

The middle is the expected output but the first and the last line not. Neither of them are contained in the interactions.x.y file, which only contains a title in the beginning describing the columns and data. Test grep shows confirms that the data is not present.

The weirdest thing is that if I log in to the same machine and run the script from terminal (even su-ing as the www-data), the output is just the middle line, as it should be.

I have tried to export env and set from bash right before the said command and re-import them before running the script trying to recreate what is happening on the server, with no avail.

The script itself is not invoked directly, there is a CGI-included perl-script executing a system call to run the script via bash.

What is the source of that output? How can I at least reproduce it?

  • 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-29T05:57:43+00:00Added an answer on May 29, 2026 at 5:57 am

    There is no need to use more, and it is likely the source of the ‘:::’s you’re getting.
    more is a paging facility, and it expects a key press (maybe the space bar), to tell it, ‘display the next page’. In this context your script isn’t giving any input to keep the data moving. I’m guessing here but the ‘:’ is a prompt char.

    The super-short cut is to give grep the filename, i.e.

    grep -v "#" ../download/interactions.$1.$2 | awk '($2!~/_R/){print $2}' | sort -k 1 | uniq > rna.names.txt
    

    Or if you have a manager that is suspicious of change, then

    cat ../download/interactions.$1.$2 | grep -v "#" | awk '($2!~/_R/){print $2}' | sort -k 1 | uniq > rna.names.txt
    

    Finally, the most efficent solution would be

       awk '($0 !~ /#/ && $2 !~ /_R/){print $2}' ../download/interactions.$1.$2 | sort -u -k > rna.names.txt
    

    (I don’t think you need the ( ) surrounding your $2!~/_R/ test.)

    I hope this helps.

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

Sidebar

Related Questions

I have been given the enviable task of migrating a legacy SQL Server 2000
I'm migrating data from a legacy database that has many tables with primary keys
Subject: Migrating very complex, legacy client-server application to SAS enabled web-version using NOSQL We
We have an application with legacy code that relies on prototype, but we've found
We have a range of legacy applications that we are trying to migrate to
I have an unconventional legacy asp.net 1.1 web app that uses the src attribute
I have a legacy desktop accounting application developed using Delphi 5 & Paradox, which
I have a bit old project that I would call legacy. Some characteristics of
We have legacy character codes that we want to store as numbers in a
I have a legacy SQL schema which looks something like this: CREATE TABLE `User`

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.