Changeset 29457


Ignore:
Timestamp:
11/20/14 21:00:44 (6 years ago)
Author:
ak19
Message:

When processing files updated after doing the translation submission step, want to check if all that has changed in any given file is comments and extra (empty) lines. For GS3 translations, lots of files get created or marked as modified, yet they may not actually contain anything substantial.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/gti/remove_extra_lines.sh

    r29039 r29457  
    2424cat $CLEANVERSION_NAME | sed -e 's/ *# Updated .[0-9]*\-...\-.....*$//' > $1
    2525
     26# To test if there were ultimately no relevant changes, work on the temporary *.clean file:
     27# remove all lines that are merely empty/spaces
     28# and any lines that are purely comments (though these may start with spaces)
     29# Then test if the *.clean file is non-empty at the end of it
     30# double sed operation to remove all comments and then all empty lines:
     31#   http://stackoverflow.com/questions/22080937/bash-skip-blank-lines-when-iterating-through-file-line-by-line
     32#cat $1 | sed -e 's/^\s*(#.*)$//' > $CLEANVERSION_NAME
     33sed -e '/\s*#.*$/d' -e '/^\s*$/d' $1 > $CLEANVERSION_NAME
     34
     35# if the *.clean file is actually empty, print a message
     36# http://www.unix.com/shell-programming-and-scripting/21753-check-if-file-empty.html
     37if [[ ! -s $CLEANVERSION_NAME ]] ; then
     38    echo "@@@ $1 only has comments and empty lines/spaces."
     39fi ;
    2640rm $CLEANVERSION_NAME
     41
    2742
    2843echo "**** cleaned version $1"
Note: See TracChangeset for help on using the changeset viewer.