Questions tagged [csplit]

For questions pertaining csplit, a utility that split files based on context.

Filter by
Sorted by
Tagged with
1 vote
2 answers
96 views

Split file into specific output filenames by pattern match

I have a file with this content: # new file text in file 1 # new file text in file 2 # new file text in file 3 The pattern here is # new file. I instead of saving each file to xx00, xx01 and xx02, ...
Smeterlink's user avatar
0 votes
0 answers
37 views

Does csplit read fully line into memory if not required?

Suppose I have a 100GB file that I want to split into parts, the different parts being separated by a fixed marker. The marker is just a fixed string of about 20 character, and hence the regex to ...
user2520938's user avatar
0 votes
1 answer
102 views

using csplit to split a file based on a regular expression to multiple files

I have a text file that has the contents of the example below, and I would like to split the file to multiple files. [TXT] /path/to/[TXT] [BAT] /path/to/[BAT] [TXT] /path/to/blah/[TXT] [BAT] /...
AeroMaxx's user avatar
  • 189
2 votes
1 answer
1k views

How do I use modern coreutils on Mac?

How do I get modern coreutils on mac? I ran into this problem using csplit: foo.txt: foo 1 foo 2 foo 3 $: csplit foo '^foo$' '{*}' # error Double checking the manpage, man csplit, csplit on Mac is ...
Chris's user avatar
  • 961
1 vote
2 answers
174 views

Divide a fasta file with scaffolds into same lenght files respecting the scaffold ID and the sequence

I am currently working with a large fasta file (3.7GB) that has scaffolds in it. Each scaffold has a unique identifier that starts with > on the first line and on the consecutive line it has the ...
Nadia Tamayo's user avatar
0 votes
1 answer
237 views

Help me understand a script that uses csplit and sed

I wanted a simple way to export notes from the reference manager, Zotero. I start by selecting multiple notes and dragging them into a blank text file. I also want achieve "atomicity" of my ...
Christopher J Poor's user avatar
4 votes
2 answers
722 views

How to split a file into multiple file after N appearence of a pattern?

I have a file on Linux, containing the coordinates of thousands of molecules. Each molecule starts with a line containing always the same pattern: @<TRIPOS>MOLECULE And then continues with ...
ginopino's user avatar
  • 380
0 votes
1 answer
893 views

How to make csplit start outputing files with filenames starting from 001?

I use csplit to divide a complex file named file.docked.pdb to small files. csplit -k -s -n 3 -f file.docked. file.docked.pdb '/^ENDMDL/+1' '{'7'}' man csplit explains the following the code ...
Praveen Kumar-M's user avatar
2 votes
3 answers
2k views

csplit multiple files into multiple files

folks- I'm a bit stumped, on this one. I'm trying to write a bash script that will use csplit to take multiple input files and split them according to the same pattern. (For context: I have multiple ...
Wayne's user avatar
  • 35
0 votes
1 answer
735 views

Split file into n files using csplit (or similar tool)

I have a huge file with the following pattern: ABC line 1 line 2 line 3 ABC line 1 line 2 ABC line1 ABC line 1 line 3 Using csplit tool I'm able to split the file above according to /ABC/ pattern ...
Andrej's user avatar
  • 343
2 votes
1 answer
518 views

Bash - extract an indented code block into new file

I have a bunch of LilyPond files in the following format: \score { \new StaffGroup = "" \with { instrumentName = \markup { \bold \huge \larger "1." } } << \new Staff = "celloI" \...
nath's user avatar
  • 5,694
0 votes
1 answer
192 views

Splitting a file based on values next to matching pattern

I am having a file input.txt which include ~50,000 rows and ~100 column. I want to split is according to matching entry followed by the matching patter. File separator are both space and tab. input....
user3377241's user avatar
1 vote
1 answer
1k views

alternative to csplit - splitting after the pattern

I want to split a file after a delimiter, not before the delimiter, which is what csplit does. I can't find anything anywhere! (Also, why would there be a tool that specifically splits before a ...
LizzAlice's user avatar
  • 113
5 votes
2 answers
1k views

csplit not recognizing provided regexp

I'm working on this big file (DATA.DAT, ~900MB) which contains several other files. It's from a PS2 game. Sound samples (which are in .AIFF format), precisely what I'm after, make up most of its size....
João's user avatar
  • 53
4 votes
4 answers
873 views

text processing rows to columns for a block

I have a file containing lists on Solaris: List A hi hello hw r u List B Hi Yes List C Hello I need to transpose the lists as shown below: List A List B List C hi Hi Hello ...
John's user avatar
  • 51
2 votes
2 answers
821 views

How to split a file based on context?

I have some files that contain the results of the lldpneighbors command from all our servers. I would like to split these files into individual files for each server in order to make it easier to ...
jesse_b's user avatar
  • 37.1k
3 votes
1 answer
1k views

csplit regex with pipe (|)

i want to split file by regular expression, i have file format as below 0|t| lorem ... some text 138|t| title some text if i execute egrep "[0-9]+\|t\|" file | wc -l it counts occurrence ...
Jigar Parekh's user avatar
1 vote
2 answers
85 views

Select the contents respective to some specific content from a file and move it to an output file

I have a file tnsnames.ora and its contents are as below. NEWDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = linuxerp.de.mph.com)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = ...
sabarish jackson's user avatar
7 votes
3 answers
3k views

Exclude delimiter with csplit

Is it possible to remove the delimiter with csplit? Example: $ cat in abc --- def --- ghi $ csplit -q in /-/ '{*}' $ ls x* xx00 xx01 xx02 $ head xx* ==> xx00 <== abc ==> xx01 <== --- ...
levant pied's user avatar
3 votes
1 answer
8k views

Split a text file into multiple files, beyond the {99} limit of csplit

I'd like to split the contents of a .txt file into multiple files, but I'm encountering two questions about limitations of csplit: (1) can anyone offer a way around csplit's maximum limit of '99' ...
kehmsen's user avatar
  • 59
45 votes
4 answers
102k views

Split a file into two

I have a big file and need to split into two files. Suppose in the first file the 1000 lines should be selected and put into another file and delete those lines in the first file. I tried using split ...
Aravind's user avatar
  • 1,599