From f309f098b4bb99481455e4c51da0f498eb423704 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Sat, 30 Apr 2011 23:35:32 +0200 Subject: [PATCH] sde-config: Introduced get_field() function to extract the value of a "^#Foo: ..." line --- lib/sde-config/functions.in | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/sde-config/functions.in b/lib/sde-config/functions.in index 2848266..cd57735 100644 --- a/lib/sde-config/functions.in +++ b/lib/sde-config/functions.in @@ -2,7 +2,7 @@ # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: lib/sde-config/functions.in -# Copyright (C) 2006 - 2008 The OpenSDE Project +# Copyright (C) 2006 - 2011 The OpenSDE Project # Copyright (C) 2004 - 2006 The T2 SDE Project # Copyright (C) 1998 - 2003 Clifford Wolf # @@ -16,6 +16,14 @@ . lib/core-functions.in +# extract first value of a "^#Foo: ..." line from a set of files +# +get_field() { + local label="$1"; shift + sed -n -e "s/^#[ \t]*$label:[ \t]*\(.*\)/\1/p" "$@" 2> /dev/null | + head -n1 | sed -e 's,[ \t]*$,,' +} + # Function to cache config.in and subconfig.in file lists # create_configin_list() {