- To: "Voytek" <lists@xxxxxxxxxx>
- Subject: Re: [SLUG] splitting text files by key word lines ?
- From: Michael Chesterton <chestie@xxxxxxxxxxxxxxx>
- Date: Sat, 04 Sep 2004 16:17:52 +1000
- Cc: slug@xxxxxxxxxxx
- User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux)
"Voytek" <lists@xxxxxxxxxx> writes:
> # grep 'Current Database' koala
> -- Current Database: atom
> -- Current Database: commodore
> -- Current Database: digiprint
> -- Current Database: documents
> .....
Practicing my awk, try this
awk 'BEGIN { bakfile = "nodb.sql" }
{ if (/^-- Current Database:/)
bakfile = $4 ".sql"
}
{
print >bakfile
}' < koala