Re: SPLIT a file based on String

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nat Gross wrote:

On 12/25/05, Richard England <rengland@xxxxxxxxxx> wrote:
Nat Gross wrote:

Hi;
I need something like SPLIT, but instead of splitting based on bytes
or lines, I want it to start a new file every time it encounters a
"CREATE TABLE" string.
I am a newbie with command line tools.

Thank you all;
-nat



csplit -k -f section testfile  '/CREATE TABLE/' {*}

This should help.   -f section   makes the split data show up in files
called  'section01', 'section02', etc. -k keeps it from deleting output
files created if an error occurs.  'testfile' is the input file,
'/CREATE TABLE/' is the regular expression used to match and {*}  uses
the previous reg. exp.  as many times as necessary.

Thank you much! Not only for the solution, but the  explanation! I
wish all answers were so concise and to the point.
-nat

You're welcome. I guess too many years in SW support shows. :-)
--
------------------------------------------------------------------------
/--R/


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux