#!/usr/bin/mawk -We
# *********************************************************************
# perlrdbtotable: converts tables from the Perl rdb format to nosql
# format
#
# Copyright (c) 2005 James A. Hart
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# *********************************************************************
# $Id: perlrdbtotable,v 1.1 2006/01/10 17:16:59 carlo Exp $

BEGIN {
	FS = "\t"
}
/^ *#/ {
	# skip comment lines
	next
}
outOfComments == 0 {
	# This is the field name line. Convert its format.
	outOfComments = 1
	sub(/^/,"\001")
	gsub(/\t/,"\001\t")
	print
	getline  # skip the field format line
	next
}
{ print }
