<commit_before># $Id: subst.mk,v 1.2 2006/11/29 22:38:33 tho Exp $
#
# targets: subst
#
# variables:    
#   SUBST_RULE      substitution rule (see further on)
#   SUBST_SUFFIX    if a substitution is requested to have output file X the 
#                   input file is read from X.$(SUBST_SUFFIX)
#
# we have two different kind of SUBST_RULE, shortcut and full: if SUBST_SUFFIX 
# is defined, then SUBST_RULE = <output_file> <"sed(1) command">, otherwise
# SUBST_RULE = <input_file> <output_file> <"sed(1) command">.

ifndef SUBST_RULE
subst:
	$(warning SUBST_RULE must be defined when including subst.mk template !)
else    # SUBST_RULE
subst:
ifndef SUBST_SUFFIX
	@set $(SUBST_RULE) ; \
	while [ $$# -ge 3 ]; \
	do \
	    fin=$$1 ; shift ; \
	    fout=$$1 ; shift ; \
	    rule=$$1 ; shift ; \
	    echo "sed '"$$rule"' $$fin > $$fout" ; \
	    sed -e "$$rule" $$fin > $$fout ; \
	done<commit_msg>[makl] subst.mk, added a note about '$' escaping<commit_after># $Id: subst.mk,v 1.3 2006/11/30 00:31:52 tho Exp $
#
# targets: subst
#
# variables:    
#   SUBST_RULE      substitution rule (see further on)
#   SUBST_SUFFIX    if a substitution is requested to have output file X the 
#                   input file is read from X.$(SUBST_SUFFIX)
#
# we have two different kind of SUBST_RULE, shortcut and full: if SUBST_SUFFIX 
# is defined, then SUBST_RULE = <output_file> <"sed(1) command">, otherwise
# SUBST_RULE = <input_file> <output_file> <"sed(1) command">.
#
# NOTE: a '$' sign in the sed(1) command must be escaped (i.e. '$$') if it 
# wants to survive the GNU make variable expansion:
#   => SUBST_RULE = A.in A.out "s/\!$$/\?/g" 
# results into:
#   => sed 's/\!$/\?/g' A.in > A.out

ifndef SUBST_RULE
subst:
	$(warning SUBST_RULE must be defined when including subst.mk template !)
else    # SUBST_RULE
subst:
ifndef SUBST_SUFFIX
	@set $(SUBST_RULE) ; \
	while [ $$# -ge 3 ]; \
	do \
	    fin=$$1 ; shift ; \
	    fout=$$1 ; shift ; \
	    rule=$$1 ; shift ; \
	    echo "sed '"$$rule"' $$fin > $$fout" ; \
	    sed -e "$$rule" $$fin > $$fout ; \
	done
{'fraction_non_alphanumeric': 0.15087040618955513, 'fraction_numerical': 0.021760154738878143, 'mean_word_length': 2.9636015325670497, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2036215', 'n_tokens_mistral': 829, 'n_tokens_neox': 788, 'n_words': 236}