Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • wmseq
    Member
    • May 2011
    • 71

    why doesn't this linux command work for me?

    Hi every one,
    I'd like merging the following two HTSeq-count outputs using the following command--- paste UHR1_htseq-count.out UHR2_htseq-count.out brain1_htseq-
    count.out brain2_htseq-count.out | awk -F "\t" '{print
    $1"\t"$2"\t"$4"\t"$6"\t"$8 }' > All_htseqCounts.txt


    head UHR1_htseq-count.out
    A1BG 67
    A1CF 31
    A2BP 3

    head UHR2_htseq-count.out
    A1BG 67
    A1CF 39
    A2BP 1
    -----
    I got the following output.

    A1BG 67 A1BG 67
    A1CF 31 A1CF 39
    A2BP 3 A2BP 1
    ----
    In fact I want to get the folloing one.

    A1BG 67 67
    A1CF 31 39
    A2BP 3 1

    Is there any one who know what is wrong with the command?

    Thanks a lot?

    Richard
  • Richard Finney
    Senior Member
    • Feb 2009
    • 701

    #2
    paste file1 file2 | awk '{print $1" "$2" "$4}'

    Comment

    • wmseq
      Member
      • May 2011
      • 71

      #3
      Richard,
      I still got the same output---just merged the two files with ID of each kept.

      Comment

      • dpryan
        Devon Ryan
        • Jul 2011
        • 3478

        #4
        Perhaps tab isn't the default delimiter for paste on your system? Maybe then

        Code:
        paste -d "\t" file1 file2 | awk '{OFS="\t"; print $1,$2,$4}'
        Alternatively, perhaps the files aren't actually tab delimited to begin with (try running "cut -f 1" on one of them).

        Comment

        • Richard Finney
          Senior Member
          • Feb 2009
          • 701

          #5
          Are you using bash?
          Run this command ...

          set | grep FS

          Also, look at the actual bytes ...
          od -x UHR1_htseq-count.out | head

          to see if that's a space or a tab.

          Comment

          Latest Articles

          Collapse

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by SEQadmin2, 06-05-2026, 10:09 AM
          0 responses
          15 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 06-04-2026, 08:59 AM
          0 responses
          33 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 06-02-2026, 12:03 PM
          0 responses
          35 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 06-02-2026, 11:40 AM
          0 responses
          23 views
          0 reactions
          Last Post SEQadmin2  
          Working...