Split file not working
1
0
Entering edit mode
2.0 years ago
jaqx008 ▴ 90

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

unix file split • 397 views
3
Entering edit mode
2.0 years ago

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?

0
Entering edit mode

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

0
Entering edit mode

which split gave

/usr/bin/split

0
Entering edit mode

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

0
Entering edit mode

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.

0
Entering edit mode

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

0
Entering edit mode

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