Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Aug 2008 17:48:03 GMT
From:      Konrad Jankowski <konrad@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 147477 for review
Message-ID:  <200808151748.m7FHm3bB027646@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=147477

Change 147477 by konrad@vspredator on 2008/08/15 17:47:05

	Optimize getting the line numbers from source file, as suggested by Diomidis.

Affected files ...

.. //depot/projects/soc2008/konrad_collation/scripts/localedef.sh#3 edit
.. //depot/projects/soc2008/konrad_collation/scripts/posix.sh#4 edit

Differences ...

==== //depot/projects/soc2008/konrad_collation/scripts/localedef.sh#3 (text+ko) ====

@@ -14,11 +14,11 @@
 OUTFILE=collate_in.src
 
 # Get the line numbers of starting and ending of the collation definition.
-LINE1=`grep -n ^LC_COLLATE $SRC | awk -F : ' { print $1 } '`
-LINE2=`grep -n "^END LC_COLLATE" $SRC | awk -F : ' { print $1 } '`
+LINE1=`awk '/^LC_COLLATE/ { print FNR}' $SRC`
+LINE2=`awk '/^END LC_COLLATE/ { print FNR}' $SRC`
 
-# Process the input file with sed and save the output compressing spaces.
-# Basically, just cut out the collation data.
+# Cut out the collation data. Erase carriage return.
+# Comment out lines starting with "*";
 sed -n -e "$LINE1,${LINE2}p" $SRC | tr -d '\r$' | sed -e 's/^*/#/g' > $OUTFILE
 
 #printf "1a\ncharmap /usr/home/versus/colldef.apple/data2/UTF-8.cm.new\n.\nwq\n" | ed -s $OUTFILE

==== //depot/projects/soc2008/konrad_collation/scripts/posix.sh#4 (text+ko) ====

@@ -14,8 +14,8 @@
 OUTFILE=colldef_in.src
 
 # Get the line numbers of starting and ending of the collation definition.
-LINE1=`grep -n ^LC_COLLATE $SRC | awk -F : ' { print $1 } '`
-LINE2=`grep -n "^END LC_COLLATE" $SRC | awk -F : ' { print $1 } '`
+LINE1=`awk '/^LC_COLLATE/ { print FNR}' $SRC`
+LINE2=`awk '/^END LC_COLLATE/ { print FNR}' $SRC`
 
 # Process the input file with ed and save the output compressing spaces.
 # Basically, just cut out the collation data.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808151748.m7FHm3bB027646>