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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:18:22+00:00 2026-05-26T10:18:22+00:00

I came across some problem with playing with ‘grep’; and probably about grepping a

  • 0

I came across some problem with playing with ‘grep’; and probably about grepping a tab.
I have two files shown as below, both of which are tab-delimited.

FM_DEL_50r.bed
chr1    3392391 3658426 DEL chr1    3392364 3658425 DEL
chr1    4011952 4392064 DEL chr1    4011953 4392062 DEL
chr1    4468526 4665322 DEL chr1    4468523 4665322 DEL

FC_DEL_50r.bed
chr1    2612264 2613324 DEL chr1    2612205 2613007 DEL
chr1    3392391 3658426 DEL chr1    3392391 3658426 DEL
chr1    4011952 4392064 DEL chr1    4011953 4392060 DEL

I hope to grep some lines which appear in both files:

cat FC_DEL_50r.bed |grep `cat FM_DEL_50r.bed |head -2|tail -1|awk '{print $2"\t"$3}'`

However there’s error:

grep: 4392064: No such file or directory

I tried cat FM_DEL_50r.bed |head -2|tail -1|awk '{print $2"\t"$3}', it actually works and outputs 4011952 4392064

So maybe we cannot grep format like ‘number”\t”number”?
thx

edit:
how stupid I am. I should use double-quotes……….(I first used single-quote and didn’t work…)

cat FC_DEL_50r.bed |grep "`cat FM_DEL_50r.bed |head -2|tail -1|awk '{print $2"\t"$3}'`"

Follow-up questions:
I wrote a bash script, based on the questions above:

#!/bin/bash
for((c=1;c<=542;c++))
do
    LINE=`head -$c FM_DEL_50r.bed|tail -1`
        P1=`cat $LINE|awk '{print $1"\\t"$2"\\t"$3}'`
        GREP1=`cat FC_DEL_50r.bed |grep "$P1"`
        X1=`cat $GREP1 |awk '{print $5"\\t"$6"\\t"$7}'`

        P2=`cat $LINE|awk '{print $5"\\t"$6"\\t"$7}'`
        GREP2=`cat MC_DEL_50r.bed |grep "$P2"`
        X2=`cat $GREP2 |awk '{print $5"\\t"$6"\\t"$7}'`

        if [ $X1 -eq $X2 ]
        then 
           echo "$LINE"\t"$X1"
        fi
done

However it produces

cat: chr1: No such file or directory
cat: 27122653: No such file or directory
cat: 27446984: No such file or directory
cat: DEL: No such file or directory
cat: chr1: No such file or directory
cat: 27880115: No such file or directory
cat: 28225069: No such file or directory
cat: DEL: No such file or directory

Seems it splits all columns of one line and cannot recognize them.
What’s the problem this time?
thx

  • 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-26T10:18:22+00:00Added an answer on May 26, 2026 at 10:18 am

    grep syntax 1-o-1

    grep [options] PATTERN [FILE...]

    This means grep pattern shown as in PATTERN in file [FILE…]

    the pattern txt can not have spaces or tabs (unless quoted) as it will be then evaluated as an argument to grep command. So in your case the command effectively becomes

    cat FC_DEL_50r.bed |grep 4011952 4392064

    The second part (After pipe ) is basically asking to grep 4011952(pattern) in 4392064(Which needs to be a file)

    To fix this, add double quotes around your second expression as :

    cat FC_DEL_50r.bed |grep "cat FM_DEL_50r.bed |head -2|tail -1|awk ‘{print $2″\t”$3}’"

    +1 for all the details presented in the question.

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

Sidebar

Related Questions

I came across some javascript at work today that used jQuery to fetch two
I have been reading over some code lately and came across some lines such
I was reading about App Engine on wikipedia and came across some GQL restrictions:
I recently made some changes to my development environment and came across a problem.
I'm relatively new at PHP and came across a slight problem. I have a
I have recenty came across a problem while importing older data than my current
I was experimenting with some examples and came across a problem that if we
recently i came across strange problem while uploading files to my new server. I
I recently came across a big problem, as I have a system that's paying
I recently tried appending two byte array slices in Go and came across some

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.