When I use the cut command, it does not work on all rows. What is the solution to this problem?
1
0
Entering edit mode
2.2 years ago
Ahmad ▴ 10

Hi every one

I have txt file contains more columns and rows, I need cut some columns by cut command, I don't use awk command لاecause I want to cut more ranges from columns (like c1-c16 , c27-55).

But when I use the cut command, it does not work on all rows, only the first row Only the first row is cut correctly, while the rest of the rows are displayed completely without cutting.

cut -d' ' -f1-16, 26-55 Full_Data_Table.txt

this is the first 3 rows from my file

Index   Name    Address Chr Position    GenTrain Score  H25 M.GType H26 M.GType H27 M.GType H28 M.GType H29 M.GType H30 M.GType H31 M.GType H32 M.GType H33 M.GType H34 M.GType H35 M.GType H36 M.GType H37 M.GType H38 M.GType H39 M.GType N25 T.GType N26 T.GType N27 T.GType N28 T.GType N29 T.GType N30 T.GType N31 T.GType N32 T.GType N33 T.GType H01 M.GType H02 M.GType H03 M L.GType   H04 M.GType H05 M.GType H06 M T.GType   H07 M.GType H08 T.GType H09 M.GType H10 M.GType H11 M.GType H12 M.GType H13 M.GType H14 M.GType H15 M T.GType   H16 M L.GType   H17 M.GType H18 M L.GType   H19 M.GType H20 M.GType H21 M.GType H22 M.GType H23 M.GType H24 M.GType M01 M.GType M02 M.GType M03 M.GType M04 M.GType M05 M.GType M06 M.GType M07 M.GType M08 M.GType M09 M.GType M10 M.GType M11 M.GType M12 M.GType M13 M.GType M14 M.GType M15 M.GType M16 M.GType M17 M.GType M18 M.GType M19 M.GType M20 M.GType M21 M.GType M22 M.GType M23 M.GType M24 M.GType N01 T.GType N02 T.GType N03 T.GType N04 T.GType N05 T.GType N06 T.GType N07 T.GType N08 T.GType N09 T.GType N10 T.GType N11 T.GType N12 T.GType N13 T.GType N14 T.GType N15 T.GType N16 T.GType N17 T.GType N18 T.GType N19 T.GType N20 T.GType N21 T.GType N22 T.GType N23 T.GType N24 M.GType

18125   OAR20_24441405.1    31641310    20  24441405    0.970312    AB  AA  AB  AA  AA  AB  AB  AA  AA  AB  AA  AA  AA  AB  AA  AA  AA  AA  AA  AB  AA  AA  AA  AA  AA  AB  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  AA  BB  AA  AA  AA  AA  AA  AB  AA  AA  AA  BB  AA  AA  AB  AA  AA  AA  AB  AA  AA  AA  AA  AA  AB  AA  AA  AA  AA  AA  AA  AB  AA  AA  AA  AA

58012   ilmnseq_rs406679941 45641375    18  46692891    0.9673617   BB  AB  BB  AB  BB  BB  BB  BB  AB  BB  BB  BB  BB  BB  BB  AB  AA  BB  AB  AA  BB  AB  BB  AA  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  AA  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  BB  AB  AB  BB  AB  AB  AB  AA  BB  AA  BB  AB  AB  AB  AB  AA  AB  AB  AA  AB  AB  AB  AB  AB
cut txt • 1.1k views
ADD COMMENT
0
Entering edit mode

Then obviously the other rows aren't actually delimited by space

 cat -vet yourFile

To check..

ADD REPLY
0
Entering edit mode

all of them tab delimited

ADD REPLY
0
Entering edit mode

Tab should be the default delimiter for cut. What happens if you remove -d option.

ADD REPLY
0
Entering edit mode

So

cut -d $'\t'
ADD REPLY
0
Entering edit mode
2.2 years ago

Your file seems to be tab-delimited, so do not pass -d ' ' to the cut

(posting this just to mark the question resolved)

ADD COMMENT

Login before adding your answer.

Traffic: 2225 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6