[chuug] using csplit

David Clymer david at zettazebra.com
Wed Sep 12 23:50:03 EDT 2007


If I want to split a file into several smaller ones at each line
starting with "b", such that the lines starting with "b" do not appear
in the split out files, how do i get csplit to do this?

given a file that looks like this:

a
b
a
a
c
d
b
d
d
a
g

doing:

$ csplit foo /^b/ '{*}'

gives me:

a
---
b
a
a
c
---
b
d
d
d
a
g

How do I split this into files such as this ("--" indicating a new
file):

a
---
a
a
c
---
d
d
d
a
g


Is this possible to do using only csplit? I know I could do it in other
ways, but somehow I expect that a tool such as this should be able to do
it, and I am just overlooking something obvious.

-davidc
-- 
gpg-key: http://www.zettazebra.com/files/key.gpg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://listmgr.cv.nrao.edu/pipermail/chuug/attachments/20070912/f5c66c19/attachment.bin 


More information about the Chuug mailing list