Tag Info

New answers tagged


Turns out screen now has a layout facility that will keep track of splits. In order for the pair to see the current layout just save it as the default: ctrl-a:layout save default


The split is done in the screen client, not in the screen session itself. pair may split his screen any way he wants, independent of your split.


csplit -zf file file.txt /^1111111/ "{*}" csplit (coreutils) is a nice command for splitting a file by context lines, (number of lines, patterns)


Another possible awk without headers in files: awk '/^1111111/ { close("file" i); i++; } { print > "file" i; }' file And second one with headers as I assume headers are constructed from the first filed after 1111111 though the last one does not seem to be like that: awk '/^1111111/ { close(f); i++; s = $1; next; } { if (s) { f = "file" i; header = ...


So you want to split this file on 11111111, is that correct? Try awk -vRS=1111111 'NR>1{print RS$0 >"file"NR-1}' file


This should work for you #!/usr/bin/perl use strict; use warnings; my$in=shift(@ARGV); my$filecount=0; my$open=0; open(IN,'<',$in) or die $!; while(<IN>) #reading input file { if($_=~/^111/) #start new output file, if a line begins with multiple 1s { close OUT or die $! if $open==1; $filecount++; ...


If you don't need the new files to be contiguous chunks of the original file, you can do this entirely with sed in the following way: sed -n -e '1~16,+3w1.txt' -e '5~16,+3w2.txt' -e '9~16,+3w3.txt' -e '13~16,+3w4.txt' The -n stops it from printing each line, and each of the -e scripts is essentially doing the same thing. 1~16 matches the first line, and ...

Top 50 recent answers are included