PERFORCE change 147477 for review

Konrad Jankowski konrad at FreeBSD.org
Fri Aug 15 17:48:03 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=147477

Change 147477 by konrad at 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.


More information about the p4-projects mailing list