Commit adc680b1 authored by kpetersn's avatar kpetersn
Browse files

Initial commit of working script. Outputs to stdout. Redirect to a file to create the alias db.

# Generate alias statements for each record in a database.
import argparse as ap
import os.path
import re
aliasLines = []
def main(dbName):
recTest = re.compile('^record|^grecord')
recNmTest = re.compile('"(.*)"')
dbfd = open(dbName, 'r')
for line in dbfd:
if recTest.match(line):
recName =[0]
#!print recName
aliasName = "A)".join(recName.split(")"))
#!print aliasName
aliasLine = 'alias("{0}", "{1}")'.format(recName, aliasName)
if __name__ == '__main__':
parser = ap.ArgumentParser()
parser.add_argument("db", help="EPICS database containing records to be aliased")
args = parser.parse_args()
#!print args
#!print args.db
if os.path.isfile(args.db):
print('Error: database does not exist: {0}'.format(args.db))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment