Question: Split file not working
0
gravatar for jaqx008
18 months ago by
jaqx00870
jaqx00870 wrote:

For some reason split -l stopped working on my terminal or through shell script. Someone please help.

example:

split -l 1 xy.bed

it outputs xaa with all lines in xy.bed

file split unix • 316 views
ADD COMMENTlink modified 18 months ago by zx87549.7k • written 18 months ago by jaqx00870
3
gravatar for WouterDeCoster
18 months ago by
Belgium
WouterDeCoster44k wrote:

How many lines are in xy.bed? Can you show us a few of those lines?

Did you manipulate this file on Windows? If so, does dos2unix xy.bed change the results of split?

ADD COMMENTlink written 18 months ago by WouterDeCoster44k

Also worth checking is which split, and ensuring it's the actual split command one expects.

ADD REPLYlink written 18 months ago by _r_am31k

which split gave

/usr/bin/split

ADD REPLYlink written 18 months ago by jaqx00870

there are 200 lines in bed. text was made with text wrangler. it was working before were i tried to run the command with a bed file with about 6 million lines and I think it died or the command is broken or something. the out put xaa contains 200 lines as well. see few lines below

a   755386  763541
b   1260608 1268527
c   785865  793644
2   2573604 2580316
e   1828161 1833986
f   162738  168420
ADD REPLYlink modified 18 months ago • written 18 months ago by jaqx00870

Check your line endings. You should be able to use a simple sed 's/\r/\n/' file to replace any carriage returns with new lines.

ADD REPLYlink written 18 months ago by _r_am31k

My bad the file was made in excel. that may be the reason. I am about to see

ADD REPLYlink written 18 months ago by jaqx00870

This was the problem all along. Thanks for all your help

ADD REPLYlink written 18 months ago by jaqx00870
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1326 users visited in the last hour