port of csvquote to awk. no command line options support yet. it's slow

#!/usr/bin/awk -f
# csvquote in awk
# TODO assign the special characters using command line flags
# TODO add header mode

BEGIN {
    # read one line at a time
    FS="";
    OFS=FS;
    delimiter=",";
    recordsep="\n";
    quotechar="\"";
    delimiter_code="\035";
    recordsep_code="\034";
    replace_mode = 1; # true. if restore mode then 0
    # existing_state is a global variable
    existing_state[1] = 0; # false
    existing_state[2] = 0; # false
    existing_state[3] = ""; # empty buffer
}

function replace_special_chars(c) {
    # existing_state is a global variable. it could be passed in as an array
    # (pass-by-ref) but we still need to persist its state from one input
    # line to the next and it needs to be altered by this function, so
    # can't be simple variables
    quote_in_effect = existing_state[1];
    maybe_escaped_quote_char = existing_state[2];
    writebuf = existing_state[3];

    if (maybe_escaped_quote_char) {
        if (c != quotechar) {
            # this is the end of a quoted field
            quote_in_effect = 0; # false
        }
        writebuf = writebuf c; # concat
        maybe_escaped_quote_char = 0; # false
    } else if (quote_in_effect) {
        if (c == quotechar) {
            # this is either an escaped quote char or the end of a quoted
            # field. need to read one more character to decide which
            writebuf = writebuf c; # concat
            maybe_escaped_quote_char = 1; # true
        } else if (c == delimiter) {
            writebuf = writebuf delimiter_code; # concat
        } else if (c == recordsep) {
            writebuf = writebuf recordsep_code; # concat
        } else {
            writebuf = writebuf c; # concat
        }
    } else {
        # quote not in effect
        writebuf = writebuf c; # concat
        if (c == quotechar) {
            quote_in_effect = 1; # true
        }
    }

    existing_state[1] = quote_in_effect;
    existing_state[2] = maybe_escaped_quote_char;
    existing_state[3] = writebuf;
}

function restore_special_chars(c) {
    writebuf = existing_state[3];
    if (c == delimiter_code) {
        writebuf = writebuf delimiter; # concat
    } else if (c == recordsep_code) {
        writebuf = writebuf recordsep; # concat
    } else {
        writebuf = writebuf c; # concat
    }
    existing_state[3] = writebuf;
}

(replace_mode) {
    # do this for every input line
    for (i=1;i<=NF;i++) {
        replace_special_chars($i);
    }
    printf("%s", existing_state[3]);
    existing_state[3] = "";
    replace_special_chars(RS);
}

(!replace_mode) {
    # restore the original special characters
    # do this for every input line
    for (i=1;i<=NF;i++) {
        restore_special_chars($i);
    }
    printf("%s", existing_state[3]);
    existing_state[3] = "";
    restore_special_chars(RS);
}

END {
    printf("%s", existing_state[3]); #flush
}

error: pathspec 'csvquote.awk' did not match any file(s) known to git


Add a simple stats tool

Add a simple stats tool

#Script to sort rule matches from LanguageTool
#Usage: gawk -f stats.awk <file_created_by_LanguageTool>
#(c) 2008, Marcin Mikowski
#Licensed on the terms of LGPL 3.0

/[0-9]+\.\)/ {
gsub(/^.*ID: /,"")
rule_cnt[$0]++
current_rule=$0
rulematch=1
}
/^$/ {current_rule=""}
/^(Message: |Suggestion: |\.\.\.)/ {
comments[current_rule]= comments[current_rule] "\n" $0
}
/^ / && / \^/ {
comments[current_rule]= comments[current_rule] "\n" $0 "\n"
}
END {
if (rulematch==1) {
print "LanguageTool rule matches in descending order"
print "============================================="
print ""
}
z = asorti(rule_cnt, rule_names)
#for (i = 1; i <= z; i++)
 #   print i " " rule_names[i]
n = asort(rule_cnt, rules)

for (i = z; i >= 1; i--) {

	for (j = 1; j <= z; j++) {
#		print j " " rule_names[j] " => " rule_cnt[rule_names[j]]
		if (rule_cnt[rule_names[j]]==rules[i] \
			&& printed[rule_names[j]]!="done") {
				printed[rule_names[j]]="done"
				rule=rule_names[j]
	print "Rule ID: " rule ", matches: " rule_cnt[rule]
	print comments[rule]
	print "============="
		}
	}
}
}

error: pathspec 'trunk/JLanguageTool/src/dev/tools/stats.awk' did not match any file(s) known to git


Hello world in AWK language

Hello world in AWK language

error: pathspec 'Hello' did not match any file(s) known to git
error: pathspec 'AWK/Sudhanshu36.awk' did not match any file(s) known to git


Find largest ordered word

Find largest ordered word

# Largest ordered word
# Copyright 2015 Dennis Decker Jensen
# Tectonics: awk -f ordered-words.awk < /usr/share/dict/words

BEGIN {
        maxlen = length(max = "")
}
{
        word = $0
        len = length(word)
        if (len < maxlen) next
        for (i = 1; i <= len - 1; ++i)
                if (substr(word, i, 1) < substr(word, i + 1, 1))
                        maxlen = length(max = word)
}
END {
        printf("Largest word '%s' is %d characters long\n", max, maxlen)
}

error: pathspec 'praxis/ordered-words.awk' did not match any file(s) known to git


checkpoint

checkpoint

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/stuartyeates/rsnz-fellows.git/'


first

first

#
# check_affix.awk
#  check affix file for Oo myspell
#
function is_fx(s)
{
   if(s == "PFX")
	  return 1;
   if(s == "SFX")
	  return 2;
	 if(s == "REP")
	  return 3;
   return 0;
}
BEGIN {linenr = 0; nr = 0;}

    { ++linenr;
	   if(nr){
		  if(sorszam++ == nr){
		     sorszam = 0;
			  nr = 0;

			  if(NF > 1 && substr($0,1,1) != "#" && ((is_fx($1) < 3) && (is_fx($1) > 0)  && ($4 + 0) == 0)){
		        print "2. error in line " linenr " line:" $0;
#			  next;
           }
		  }
		  else if($1 != veg || ((fxtyp < 3) && (($2 != typ) || (NF < 5)) )){
		    print "1. error in line " linenr" line:" $0;
		     sorszam = 0;
			  nr = 0;
			  next;
		 }
		  else
		    next;
		 }
	   while(!(ret = is_fx($1)))next;
		 veg = $1;
		 typ = $2;
		 fxtyp = ret;
		 if(ret < 3) nr = $4 + 0;
		    else nr = $2 + 0;
       sorszam = 0;
#		 print "---1 " $0" nr:"nr;
		}

error: pathspec 'trunk/languagetool/dict-de/awk/checkaffix.awk' did not match any file(s) known to git


Add a script to parse acpi_quirks into a header file that we can compile
into ACPI.  Script written by Mark Santcroos with some edits from myself.

Submitted by:	marks

#!/usr/bin/awk -f
#
# $FreeBSD$
#
# Copyright (c) 2004 Mark Santcroos <marks@ripe.net>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#

BEGIN {
	OUTPUT="acpi_quirks.h"
}

# Print header and id
NR == 1 {
	VERSION = $0;
	gsub("\^# ", "", VERSION)
	gsub("\\$", "", VERSION)

	printf("/*\n") > OUTPUT;
	printf(" * THIS FILE IS AUTOMAGICALLY GENERATED.  DO NOT EDIT.\n") \
	    > OUTPUT;
	printf(" *\n") > OUTPUT;
	printf(" * Generated from:\n") > OUTPUT;
	printf(" * %s\n", VERSION) > OUTPUT;
	printf(" */\n\n") > OUTPUT;
}

# Ignore comments and empty lines
/^#/, NF == 0 {
}

#
# NAME field: this is the first line of every entry
#
$1 == "name:" {
	ENTRY_NAME = $2;
	printf("const struct acpi_table %s[] = {\n", ENTRY_NAME) > OUTPUT;
}

#
# OEM field
#
$1 == "oem:" {
	LENGTH = length();

	# Parse table type to match
	TABLE = $2;

	# Parse OEM ID
	M = match ($0, /\"[^\"]*\"/);
	OEM_ID = substr($0, M, RLENGTH);

	# Parse OEM Table ID
	ANCHOR = LENGTH - (M + RLENGTH - 1);
	REMAINDER = substr($0, M + RLENGTH, ANCHOR);
	M = match (REMAINDER, /\"[^\"]*\"/);
	OEM_TABLE_ID = substr(REMAINDER, M, RLENGTH);

	printf("\t{ ACPI_TABLE_%s, OEM, %s, %s },\n",
	    TABLE, OEM_ID, OEM_TABLE_ID) > OUTPUT;
}

#
# CREATOR field
#
$1 == "creator:" {
	# Parse table type to match
	TABLE = $2;

	M = match ($0, /\"[^\"]*\"/);
	CREATOR = substr($0, M, RLENGTH);

	printf("\t{ ACPI_TABLE_%s, CREATOR, %s },\n", TABLE, CREATOR) > OUTPUT;
}

#
# OEM REVISION field
#
$1 == "oem_rev:" {
	TYPE = $2;
	SIGN = $3;
	VALUE = $4;

	# Parse operand
	OPERAND = trans_sign(SIGN);

	# Parse OEM revision ID
	REV = "OEM_REV";

	printf("\t{ ACPI_TABLE_%s, %s, %s, %s },\n",
	    TYPE, REV, OPERAND, VALUE) > OUTPUT;
}

#
# CREATOR REVISION field
#
$1 == "creator_rev:" {
	TYPE = $2;
	SIGN = $3;
	VALUE = $4;

	# Parse operand
	OPERAND = trans_sign(SIGN);

	# Parse creator revision ID
	REV = "CREATOR_REV";

	printf("\t{ ACPI_TABLE_%s, %s, %s, %s },\n",
	    TYPE, REV, OPERAND, VALUE) > OUTPUT;
}

#
# QUIRKS field: This is the last line of every entry
#
$1 == "quirks:" {
	printf("\t{ ACPI_TABLE_END }\n};\n\n") > OUTPUT;

	QUIRKS = $0;
	sub(/^quirks:[ ]*/ , "", QUIRKS);

	QUIRK_COUNT++;
	QUIRK_LIST[QUIRK_COUNT] = QUIRKS;
	QUIRK_NAME[QUIRK_COUNT] = ENTRY_NAME;
}

#
# All information is gathered, now create acpi_quirks_table
#
END {
	# Header
	printf("const struct acpi_blacklist acpi_quirks_table[] = {\n") \
	    > OUTPUT;

	# Array of all quirks
	for (i = 1; i <= QUIRK_COUNT; i++) {
		printf("\t{ %s, %s },\n", QUIRK_NAME[i], QUIRK_LIST[i]) \
		    > OUTPUT;
	}

	# Footer
	printf("\t{ NULL, 0 }\n") > OUTPUT;
	printf("};\n") > OUTPUT;

	exit(0);
}

#
# Translate math SIGN into verbal OPERAND
#
function trans_sign(TMP_SIGN)
{
	if (TMP_SIGN == "=")
		TMP_OPERAND = "OP_EQL";
	else if (TMP_SIGN == "!=")
		TMP_OPERAND = "OP_NEQ";
	else if (TMP_SIGN == "<=")
		TMP_OPERAND = "OP_LEQ";
	else if (TMP_SIGN == ">=")
		TMP_OPERAND = "OP_GEQ";
	else if (TMP_SIGN == ">")
		TMP_OPERAND = "OP_GTR";
	else if (TMP_SIGN == "<")
		TMP_OPERAND = "OP_LES";
	else {
		printf("error: unknown sign: " TMP_SIGN "\n");
		exit(1);
	}

	return (TMP_OPERAND);
}

error: pathspec 'sys/tools/acpi_quirks2h.awk' did not match any file(s) known to git


print ac_join(sb, RS)

print ac_join(sb, RS)

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/svnpenn/sage.git/'


Added an awk script to analyze app fractions.

#!/usr/bin/awk -f

$0 ~ "app fractions:" {
  print $0
  c=1
}

c == 1 {
  w=$(NF-1)
  if (w+0 != w)
    next
  v=$(NF)
  if (v+0 != v)
    next
  if (w == 0 && v == 0)
    next
  print $0
}

error: pathspec 'energy-data-processing/analyze-apps-fractions.awk' did not match any file(s) known to git


Add uniqueLines.awk

Add uniqueLines.awk

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/SergKolo/sh.git/'


Added an awk script for examining complete journal logs in one place.

# 2 january 2015
# usage: ./e4jexamine summary file | awk -f fulllog.awk file
# TODO pass options to e4jexamine
BEGIN {
	file = ARGV[1]
	ARGC = 1
}
{ print }
/descriptor/ {
	cmd = sprintf("./e4jexamine descdump.%s %s", $1, file)
	while (cmd | getline)
		printf "\t%s\n", $0
	close(cmd)
}

error: pathspec 'fulllog.awk' did not match any file(s) known to git


imprement md parser

imprement md parser

error: pathspec 'md2slide.awk' did not match any file(s) known to git


Added Harshad Number in AWK

Added Harshad Number in AWK

# Harshad Number implementation
# See: http://en.wikipedia.org/wiki/Harshad_number

func sumdigits(n){
    result=0;

    while(n){

        result+=(n%10);
        n=int(n/10);

    }

    return result;
}

#Test wheather a number is harshad number or not
func isharshad(n){
    return n%sumdigits(n)==0;
}

BEGIN {

  print("Testing for Harshad Numbers");
  count=0;

  #There are 33 harshad numbers in the range 1-100
  for(i=1;i<101;i++){
      #count = count + 1 if harshad number else count + 0
      count+= isharshad(i) ? 1 : 0 ;
  }

}
END {

 print("The test was ",count==33?"Successful":"Unsuccessful");

}

error: pathspec '10_Harshad_Number/AWK/wasi0013/HarshadNumber.awk' did not match any file(s) known to git


Add an awk script to list all targets returned by xcodebuild -list

BEGIN {
    FS = "\n"
}

/Targets:/ {
    while (getline && $0 != "") {
        sub(/^ +/, "");
        print;
    }
}

error: pathspec 'targets.awk' did not match any file(s) known to git


add awk script to read out variable information from ncdump -h to utils

#!/bin/awk -f

# This awk script parses the output of ncdump -h to read information about
# the variables.
# The current version reads 2D and 3D variables from a CESM file.
#
# run with: ncdump -h FILE.nc4 | ./variable_information.awk > out.txt

BEGIN {
    OFS = "\t";
    print "VARIABLE", "INFO", "VALUE";
}

/float .*(time, lev, ncol)/ {
    variable = $2;
    sub(/\(.*/,"",variable); # remove dimension information
    print variable, "levels", 30;
}

/float .*(time, ilev, ncol)/ {
    variable = $2;
    sub(/\(.*/,"",variable); # remove dimension information
    print variable, "levels", 31;
}

/float .*(time, ncol)/ {
    variable = $2;
    sub(/\(.*/,"",variable); # remove dimension information
    print variable, "levels", 1;
}

/.*:long_name = / {
    var = $1;
    sub(/:long_name/,"",var); # remove ":long_name"
    if (var == variable) { # only print names when levels have been printed just before
        name = $3;
        for (i=4; i<=NF; i++) name = name " " $i;
        gsub(/"/,"",name); # remove quotes from variable name
        sub(/ ;/,"",name); # remove trailing ";" from variable name
        print variable, "name", name;
    }
}

error: pathspec 'util/variable_information.awk' did not match any file(s) known to git


2008-04-15  Martin Sebor  <sebor@roguewave.com>

	* bin/xcomp.awk: Enclosed runtime warnings in parentheses
	as documented in the legend at the bottom of the generated
	page.

git-svn-id: 8ce9432b95a2a271c6c279131eb1bb968a8ee7fb@648319 13f79535-47bb-0310-9956-ffa450edef68

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/pathscale/stdcxx.git/'


add tool.nswd/calc_surfacedensity.awk

add tool.nswd/calc_surfacedensity.awk

error: pathspec 'tool.nswd/calc_surfacedensity.awk' did not match any file(s) known to git


SCCS mkdoc.awk 10/04/29 00:19:44: date and time created 10/04/29 00:19:44 by neo

#-------------------------------------------------------------------------------
# Phorward SDK - mkdoc :: Documentation Generator
# Copyright (C) 2009, 2010 by Phorward Software Technologies, Jan Max Meyer
# http://www.phorward-software.com ++ mail<<AT>>phorward-software<<DOT>>com
#
# Script:		mkdoc.awk
# Author:		Jan Max Meyer
#-------------------------------------------------------------------------------

BEGIN	{
			SUBSEP = "#"

			print_sections = 1
			full_index = 0
			tpldir = getenv( "PHOME" ) "/tpl"
			manual = ""

			t = 1

			# Begin of program
			for( i = 1; i < ARGC; i++ )
			{
				if( ARGV[i] == "-o" )
					output = ARGV[++i]
				else if( ARGV[i] == "-i" )
					full_index = 1
				else if( ARGV[i] == "-ns" )
					print_sections = 0
				else if( ARGV[i] == "-tpl" && i+1 < ARGC )
					tpldir = ARGV[++i]
				else if( ARGV[i] == "-m" && i+1 < ARGC )
					manual = readfile( ARGV[++i] )
				else if( ARGV[i] == "-c" && i+1 < ARGC )
					allcopyright = ARGV[++i]
				else if( ARGV[i] == "-t" && i+1 < ARGC )
					alltitle = ARGV[++i]
				else if( ARGV[i] == "-u" && i+1 < ARGC )
					allusage = ARGV[++i]
				else
					files[ j++ ] = ARGV[i]
			}

			if( substr( tpldir, length( tpldir ) - 1, 1 ) != "/" )
				tpldir = tpldir "/"

			# Read all templates
			tpl[ "DOCUMENT" ] = readfile( tpldir "document.tpl" )
			tpl[ "MODULE" ] = readfile( tpldir "module.tpl" )
			tpl[ "FUNCTION" ] = readfile( tpldir "function.tpl" )
			tpl[ "parameters" ] = readfile( tpldir "parameter.tpl" )
			tpl[ "returns" ] = readfile( tpldir "returns.tpl" )
			tpl[ "refentry" ] = readfile( tpldir "refentry.tpl" )

			document = tpl[ "DOCUMENT" ]

			# Process the files
			for( i in files )
			{
				process( files[i] )

				if( print_sections )
				{
					#Output the header and index of contents
					gsub( "!!" "index", print_idx(), head_text )
					gsub( "!!" "contents", print_ref(), head_text )

					#all_text = all_text head_text
					#all_text = all_text print_ref()

					all_text = all_text head_text

					head_text = ""
				}

				if( full_index )
				{
					for( s in functions )
						all_functions[ s ] = functions[ s ]
				}

				for( s in functions )
					delete functions[s]
			}

			if( full_index )
			{
				for( s in all_functions )
					functions[ s ] = all_functions[ s ]

				if( !print_sections )
					all_text = print_ref()

				allindex = print_idx()
			}

			if( document != "" )
			{
				gsub( "!!" "title", alltitle, document )
				gsub( "!!" "usage", allusage, document )
				gsub( "!!" "copyright", allcopyright, document )
				gsub( "!!" "manual", manual, document )
				gsub( "!!" "index", allindex, document )
				gsub( "!!" "reference", all_text, document )
			}
			else
				document = all_text

			#Finally print all!
			print document
		}

function process( file )
{
	section = ""
	current_item = ""
	old_item = ""
	nodoc = 0
	line = 1

	while( getline line <file > 0 )
	{
		#this could be windoof files
		gsub( "\r", "", line )
		line = trim( line )

		section_line++

		if( line == "" )
		{
			if( current_item == "usage" || current_item == "copyright" )
				items[ current_item ] = items[ current_item ] "\n"

			continue
		}

		#Look for section?
		if( section == "NODOC" && index( line, "COD_ON" ) >= 1 )
			section = "";
		else if( section == "" )
		{
			if( index( line, "/* -MODULE" ) == 1 )
				section = "MODULE"
			else if( index( line, "/* -FUNCTION" ) == 1 )
				section = "FUNCTION"
			else if( index( line, "NO_DOC" ) >= 1 )
				section = "NODOC";

			current_item = ""
			section_line = 0
		}
		else if( section != "NODOC" )
		{
			#End of a section
			if( index( line, "--------------------------------------------" \
					"--------------------------------- */" ) == 1 \
				|| index( line, "~~~ CHANGES & NOTES ~~~" ) > 0 )
			{
				# create a function parameter synopsis!
				if( section == "FUNCTION" )
				{
					#Generate RETURNTYPE and RETURNDESC
					if( items[ "returns" ] != "" )
					{
						if( index( items[ "returns" ], " " ) )
						{
							datatype = substr( items[ "returns" ], 1, \
										index( items[ "returns" ], " " ) - 1 )
							desc = 	substr( items[ "returns" ], \
										index( items[ "returns" ], " " ) + 1 )
						}
						else
						{
							datatype = items[ "returns" ]
							desc = "Nothing"
						}

						items[ "returntype" ] = datatype

						if( desc == "" )
							desc = "Nothing."

						items[ "returndesc" ] = desc
					}

					#Generate function-name
					gsub( /\(.*\)$/, "", items[ "function" ] )

					#GENERATE SYNOPSIS
					items[ "synopsis" ] = items[ "function" ]
					#gsub( /\(.*\)$/, "", items[ "synopsis" ] )
					items[ "synopsis" ] = items[ "synopsis" ] "( "

					first = 1
					for( item in items )
					{
						if( match( item, "parameters" SUBSEP "[0-9]+" ) )
						{
							datatype = substr( items[ item ], 1, \
								index( items[ item ], " " ) - 1 )
							desc = substr( items[ item ], \
										index( items[ item ], " " ) + 1 )

							if( datatype != "..." )
							{
								param = substr( desc, 1, index( desc, " " ) - 1 )
								desc = 	substr( desc, index( desc, " " ) + 1 )
							}
							else
								param = ""

							if( !first )
								items[ "synopsis" ] = items[ "synopsis" ] ", "
							first = 0

							items[ "synopsis" ] = items[ "synopsis" ] datatype
							if( param != "" )
								items[ "synopsis" ] = items[ "synopsis" ] \
									" " param
						}
					}

					if( first )
						items[ "synopsis" ] = items[ "synopsis" ] "void )"
					else
						items[ "synopsis" ] = items[ "synopsis" ] " )"

					items[ "synopsis" ] = items[ "returntype" ] " " \
											items[ "synopsis" ]

					#Put code in array first, for sorting
					funcname =  items[ "function" ]
					#gsub( /_|\(|\)/, "", funcname )

					# GENERATE OUTPUT...
					#write index of contents as a quick reference
					if( !index( items[ "usage" ], "." ) )
						items[ "usage" ] = trim( items[ "usage" ] ) "."

					content[ funcname ] = substr( items[ "usage" ], \
											1, index( items[ "usage" ], "." ) )

					#Write output into functions array
					functions[ funcname ] = fill_tex_tpl( section, items )
				}
				else if( head_text == "" )
					head_text = fill_tex_tpl( section, items )

				#for( item in items )
					#print item " => \"" items[ item ] "\""

				for( item in items )
					delete items[ item ]

				section = ""
				current_item = ""
				continue
			}
			else if( index( line, "File:" ) == 1 )
				current_item = "file"
			else if( index( line, "Author:" ) == 1 )
				current_item = "author"
			else if( index( line, "Usage:" ) == 1 )
				current_item = "usage"
			else if( index( line, "Function:" ) == 1 )
				current_item = "function"
			else if( index( line, "Parameters:" ) == 1 )
			{
				akt_parm = 1
				current_item = "parameters" SUBSEP akt_parm
			}
			else if( index( line, "Returns:" ) == 1 )
			{
				current_item = "returns"
			}
			else if( section == "MODULE" && section_line == 1 )
				current_item = "title"
			else if( section == "MODULE" && section_line == 2 )
				current_item = "copyright"

			#Read in the item information
			if( current_item != "" )
			{
				if( current_item != old_item && items[ current_item ] == "" )
				{
					if( current_item != "title" \
						&& current_item != "copyright" )
					{
						line = trim( substr( line, index( line, ":" ) + 1 ) )
					}

					gsub( /[ \t]+/, " ", line )

					items[ current_item ] = line
				}
				else
				{
					if( match( current_item, "parameters" SUBSEP "[0-9]+" ) )
					{
						if( match( line, \
							"[A-Za-z0-9_*]+[ \t][ \t]+[A-Za-z0-9_*()]+[ \t]+|\\.\\.\\.[ \t]+" ) )
						{
							akt_parm++
							current_item = "parameters" SUBSEP akt_parm

							gsub( /[ \t]+/, " ", line )
							items[ current_item ] = line
						}
					}

					if( old_item == current_item )
					{
						gsub( /[ \t]+/, " ", line )

						if( ( section == "MODULE" && current_item == "usage" ) \
							|| current_item == "copyright" )
							delim = "\n"
						else
							delim = " "

						items[ current_item ] = items[ current_item ] delim line
					}
				}
			}

			old_item = current_item
		}

		line++;
	}

	close( getline line <file > 0 )
}

function fill_tex_tpl( section, items )
{
	final = tpl[ section ]
	parameters = ""

	for( item in items )
	{
		#print "!!" item " " items[ item ]

		#for LaTeX
		#gsub( "_", "\\_", items[ item ] )

		if( match( item, "parameters" SUBSEP "[0-9]+" ) )
		{
			datatype = substr( items[ item ], 1, \
						index( items[ item ], " " ) - 1 )
			desc = 	substr( items[ item ], index( items[ item ], " " ) + 1 )

			if( datatype != "..." )
			{
				param = substr( desc, 1, index( desc, " " ) - 1 )
				desc = 	substr( desc, index( desc, " " ) + 1 )
			}
			else
				param = ""

			subfinal = tpl[ "parameters" ]
			gsub( "!!" "datatype", datatype, subfinal )
			gsub( "!!" "param", param, subfinal )
			gsub( "!!" "desc", desc, subfinal )

			parameters = parameters subfinal
		}
		else if( item == "returns" )
		{
			subfinal = tpl[ "returns" ]
			gsub( "!!" "datatype", items[ "returntype" ], subfinal )
			gsub( "!!" "desc", items[ "returndesc" ], subfinal )

			gsub( "!!" item, subfinal, final )
		}
		else
		{
			gsub( "!!" item, items[ item ], final )
		}
	}

	if( section == "FUNCTION" )
		gsub( "!!parameters", parameters, final )

	return final
}

function print_idx()
{
	t = 1
	for( s in functions )
		sort[t++] = s

	n = asort( sort )

	refindex = ""
	for( s = 1; s <= n; s++ )
	{
		refentry = tpl[ "refentry" ]

		gsub( "!!" "function", sort[s], refentry )
		gsub( "!!" "usage", content[ sort[s] ], refentry )
		refindex = refindex refentry
	}

	for( s in sort )
		delete sort[s]

	return refindex
}

function print_ref()
{
	t = 1
	for( s in functions )
		sort[t++] = s

	n = asort( sort )

	text = ""
	for( s = 1; s <= n; s++ )
		text = text functions[sort[s]]

	for( s in sort )
		delete sort[s]

	return text
}

#--- Utility functions go here ---

function ltrim( s )
{
	sub( /^[ \t\n]+/, "", s )
	return s
}

function rtrim( s )
{
	sub( /[ \t\n]+$/, "", s )
	return s
}

function trim( s )
{
	return rtrim( ltrim( s ) )
}

function readfile( s )
{
	f = ""

	while( ( getline l < s ) > 0 )
		f = f l "\n"

	close( s )
	return f
}

function getenv( s )
{
	"echo $" s | getline v
	return v
}

error: pathspec 'run/mkdoc.awk' did not match any file(s) known to git


added prettyplz.awk

added prettyplz.awk

#!/usr/bin/awk -f
# Prettifies a Haskell list

func print_indent(ind,    i) {
	for (i = 0; i < ind; ++i)
		printf "\t"
}

{
	for (c = 1; c <= length($0); ++c) {
		ch = substr($0, c, 1)
		if (ch == "[") {
			printf "[\n"
			print_indent(++indent)
		} else if (ch == "(") {
			in_args = 1
			printf "("
		} else if (ch == ")") {
			in_args = 0
			printf ")"
		} else if (ch == ",") {
			if (in_args)
				printf ", "
			else {
				printf ",\n"
				print_indent(indent)
			}
		} else if (ch == "]") {
			printf "\n"
			print_indent(--indent)
			printf "]"
		} else {
			printf ch
		}
	}
	print ""
}

error: pathspec 'prettyplz.awk' did not match any file(s) known to git


tool.imbh/calc_highT-mass.awk

# argv: Tmaxcrit
BEGIN{
    m  = 0.;
    ms = 1.989e33;
}
{
    if($46 > Tmaxcrit) {
	m += $3;
    }
}
END{
    printf("%+e\n", m / ms);
}

error: pathspec 'tool.imbh/calc_highT-mass.awk' did not match any file(s) known to git


Added filter.awk back from master

Added filter.awk back from master

#/bin/gawk

# 07/Aug/2010 carlo cancellieri ccancellieri@hotmail.com

BEGIN{
#das flag
	das=0;
	if (DAS==1 || DAS=="das"){
		d1=1;
	}
	else {
		d1=0;
	}
#dds flag
	dds=0;
	if (DDS==1 || DDS=="dds"){
		d2=1;
	}
	else {
		d2=0;
	}
#data flag
	data=0;
	if (DATA==1 || DATA=="data"){
		d3=1;
	}
	else {
		d3=0;
	}

# simple or complete flag
	complete=0;
	simple=0;
	if (COMPLETE=="complete"){
		c=1;
		s=0;
	}
	else if (COMPLETE=="simple"){
		c=0;
		s=1;
	}
	else {
		c=0;
		s=0;
	}
# substitution
	CLASS=toupper(CLASS);
	TYPE=tolower(TYPE);

# All the rows flag
	rest=1;
}

/#DAS#/	{
	if (rest==0)	{ rest=1; das=0;}
	else	{das=d1; dds=0;	data=0; rest=0;}
#	print "DAS: "das,dds,data,rest "COMPLETE:"complete,simple
	next;
}
/#DDS#/	{
	if (rest==0)	{ rest=1; dds=0;}
	else	{das=0; dds=d2; data=0; rest=0;}
#	print "DDS: "das,dds,data,rest "COMPLETE:"complete,simple
	next;
}
/#DATA#/{
	if (rest==0)	{ rest=1; data=0;}
	else	{das=0; dds=0; data=d3; rest=0;}
#	print "DATA: "das,dds,data,rest "COMPLETE:"complete,simple
	next;
}

/#COMPLETE#/{
	if (complete==1){complete=0;}
	else {complete=1;}
#	print "COMPLETE: "complete,c,rest
	next;
}
/#SIMPLE#/{
	if (simple==1)	{simple=0;}
	else {simple=1;}
#	print "SIMPLE: "simple,s,rest
	next;
}

//{
	if (rest==1) {
		if (complete==1){
			#we are in the complete section
			if (c==1){
				#complete is what you want
				gsub(/OPENDAP_CLASS/,CLASS,$0);
				gsub(/OPENDAP_TYPE/,TYPE,$0);
				print $0
			}
			#else simple is what you want
		}
		else if (simple==1){
			#we are in the simple section
			if (s==1){
				#simple is what you want
				gsub(/OPENDAP_CLASS/,CLASS,$0);
				gsub(/OPENDAP_TYPE/,TYPE,$0);
				print $0
			}
			#else complete is what you want
		}
		else
		{
			#we are in the rest of the file
			gsub(/OPENDAP_CLASS/,CLASS,$0);
			gsub(/OPENDAP_TYPE/,TYPE,$0);
			print $0
		}
	}
	else if(das==1 || dds==1 || data==1) {
		if (complete==1){
			#we are in the complete section
			if (c==1){
				#complete is what you want
				gsub(/OPENDAP_CLASS/,CLASS,$0);
				gsub(/OPENDAP_TYPE/,TYPE,$0);
				print $0
			}
			#else simple is what you want
		}
		else if (simple==1){
			#we are in the simple section
			if (s==1){
				#simple is what you want
				gsub(/OPENDAP_CLASS/,CLASS,$0);
				gsub(/OPENDAP_TYPE/,TYPE,$0);
				print $0
			}
			#else complete is what you want
		}
		else
		{
			#we are in the rest of a (das==1 || dds==1 || data==1)
			gsub(/OPENDAP_CLASS/,CLASS,$0);
			gsub(/OPENDAP_TYPE/,TYPE,$0);
			print $0
		}
	}
}

error: pathspec 'bin/filter.awk' did not match any file(s) known to git


Added AWK

Added AWK

# Awk hello world program
# written by- Aaditya Naik (rincemust)

BEGIN {print "Hello World"}

# to run, type-
#   $ awk hello.awk

error: pathspec 'awk/hello.awk' did not match any file(s) known to git


fixing bug in style header

fixing bug in style header

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/orbifx/yamado.git/'


msa2fa.awk: Convert sscs.py .msa.tsv output to .fa.

# A quick script to convert the .msa.tsv output of sscs.py back into FASTA format.

BEGIN {
  FS = "\t";
  OFS = "\t";
}

$2 == "CONSENSUS" {
  if ($1 == last) {
    mate = 2;
  } else {
    mate = 1;
  }
  print ">" $1 "." mate;
  print $3;
  last = $1;
}

error: pathspec 'msa2fa.awk' did not match any file(s) known to git


awk script to extract the OGD-AT specifiation from a plain text representation of the PDF file

# AWK file credit to http://stackoverflow.com/users/751863/steve

BEGIN {
    RS="\nID\n"
    FS="\n"
    OFS="|"

    required["1"]; required["5"]; required["8"]; required["9"]; required["10"];
    required["11"]; required["14"]; required["15"]; required["19"]; required["21"]; required["24"];

    headpart = "Bezeichner|OGD-Kurzname|CKAN Feld|Anzahl|Definition|Erläuterung|Beispiel|ON A 2270:2010|ON/EN/ISO 19115:2003|RDF property|Definition Englisch"
    ns = split(headpart, b, OFS)
    for (i=1; i <= ns; i++) {
        a[b[i]]
    }
    print "ID" OFS headpart OFS "Occurence"
}

NR>2 {
    for (i=1;i<=NF;i++) {

        l = (l ? l (l ~ /^(extras|resources):$/ ? "" : " ") : "") $i

        if ($(i+1) == "" ) {
            if (l in a) {
                l = ""
            }
            else if (l != "") {
                c = (c ? c OFS : "") l
                n++
                if (n == 1) {
                    id = $i
                }
                l = ""
            }
        }
        if (n == 12) {
            if (c ~ /^[0-9]/) {
                if (id in required) {
                    c = c OFS "R"
                } else {
                    c = c OFS "O"
                }
            } else {
                c = "ERROR: BAD RECORD"
            }
            print c
            c = n = ""
            next
        }
    }
}

error: pathspec 'ogdatv21/convogdatspectocsv.awk' did not match any file(s) known to git


Create fix_letters.awk

Create fix_letters.awk

error: pathspec 'fix_letters.awk' did not match any file(s) known to git


1st entry of basic blast parsing using awk

#!/usr/bin/awk -f

function is_repetitive_hit(start,end,threshold,threshold2)
{
  overlap[0]= -1;
  overlap[1]= -10;

  if (region[0]>=start && region[0]<end) {
    overlap[0]=region[0];
    extent[0]=start;
  }
  else if (start>=region[0] && start<region[1]) {
    overlap[0]=start;
    extent[0]=region[0];
  }
  else { # WE HAVE NO OVERLAP, SO JUST RESET AND RETURN */
    region[0]= start; # SAVE THE CURRENT REGION FOR CHECKING THE NEXT ONE*/
    region[1]= end;
    return 0;  # NO REPETITIVE OVERLAP */
  }
  if (region[1]>=start && region[1]<end) {
    overlap[1]=region[1];
    extent[1]=end;
  }
  else {
    overlap[1]=end;
    extent[1]=region[1];
  }
  if (overlap[0]>=0) { # GOT OVERLAP */
    my_length=end-start;
    if (overlap[1]-overlap[0]>threshold*my_length && overlap[1]-overlap[0]>threshold2*(region[1]-region[0])) {
#      printf("REPEAT [%d,%d]: overlaps [%d,%d]\n",start,end,region[0],region[1]);
      region[0]=extent[0]; # SAVE THE UNION OF THE OVERLAPPING REGIONS*/
      region[1]=extent[1];
      return 1; # THIS IS A REPEAT!*/
    }
  }

  region[0]= start; # SAVE THE CURRENT REGION FOR CHECKING THE NEXT ONE*/
  region[1]= end;
  return 0;  # NO REPETITIVE OVERLAP */
}

function print_interval()
{
    if (mode=="all") {
	if (IDENTITY_PERCENT+0<identity_min) {
	    return;
	}
	if (BLAST_FRAME+0>=0) {
	    printf("MATCH_INTERVAL\t%d\t%s\t%s\t%d\t%s\t%s\t%s\t%d\t%d\t%d\n",hit_id,SEQ_ID,SUBJ_ID,BLAST_SCORE+0,E_VALUE,IDENTITY_PERCENT,BLAST_FRAME,q_interval_start,i_query-q_interval_start,s_interval_start);
	}
	else {
	    printf("MATCH_INTERVAL\t%d\t%s\t%s\t%d\t%s\t%s\t%s\t%d\t%d\t%d\n",hit_id,SEQ_ID,SUBJ_ID,BLAST_SCORE+0,E_VALUE,IDENTITY_PERCENT,BLAST_FRAME,q_interval_start,i_query-q_interval_start,i_subj-BLAST_FRAME);
	}
    }
    else if (mode=="detail") {
	printf("%d\t%d\t%d\t%d\t%d\n",hit_id,q_interval_start,i_query-1,s_interval_start,i_subj-BLAST_FRAME);
    }
}

function print_hit()
{
  if (remove_repeats) {
    if (is_repetitive_hit(QUERY_START,QUERY_END,0.9,0.8)) {
      if (nrepeat++ > 20) {
	printf("REMOVING REPEAT %d-%d\n",QUERY_START,QUERY_END);
        return 0;
      }
    }
    else {
      nrepeat=0;
    }
  }
    hit_id++;
    query_len=length(QUERY_SEQ);
    q_interval_start= -1;
    i_query=QUERY_START;
    if (BLAST_FRAME+0>0) {
	i_subj=SUBJ_START;
    }
    else {
	i_subj=SUBJ_END;
    }
    for (i=1;i<=query_len;i++) {
	if (substr(QUERY_SEQ,i,1)=="-") {
	    if (q_interval_start>0) {
		print_interval();
	    }
	    q_interval_start= -1;
	    i_subj+= BLAST_FRAME;
	}
	else {
	    if (substr(SUBJ_SEQ,i,1)=="-") {
		if (q_interval_start>0) {
		    print_interval();
		}
		q_interval_start= -1;
	    }
	    else {
		if (q_interval_start<0) {
		    q_interval_start=i_query;
		    s_interval_start=i_subj;
		}
		i_subj+= BLAST_FRAME;
	    }
	    i_query++;
	}
    }
    if (q_interval_start>0) {
	print_interval();
    }
    gsub("-","",QUERY_SEQ);
    gsub("-","",SUBJ_SEQ);
    if (mode=="summary") {
	printf("%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",hit_id,SEQ_ID,SUBJ_ID,BLAST_SCORE,E_VALUE,IDENTITY_PERCENT,BLAST_FRAME,QUERY_START,QUERY_END,SUBJ_START,SUBJ_END);
    }
    QUERY_START=9999999;
    QUERY_END= -1;
    SUBJ_START=9999999;
    SUBJ_END= -1;
}

/^Query=/ {
    SEQ_ID=$2;
    TITLE=substr($0,index($0,$3));
    QUERY_START=9999999;
    QUERY_END= -1;
}

/No hits/ {
}

/^>/ {
    if (QUERY_START<QUERY_END) {
	print_hit();
    }
    SUBJ_ID=substr($1,2);
    SUBJ_TITLE=substr($0,index($0,$2));
    BLAST_FRAME="+1"
}

/^ Score =/ {
    if (QUERY_START<QUERY_END) {
	print_hit();
    }
    BLAST_SCORE=$3;
    E_VALUE=$8;
    if (substr(E_VALUE,1,1)=="e") {
	E_VALUE="1" E_VALUE;
    }
    if (E_VALUE+0.0 == 0.0) {
	E_VALUE=300;
    }
    else {
	E_VALUE= -log(E_VALUE+0.0)/log(10.0);
	if (E_VALUE=="inf") {
	    E_VALUE=300;
	}
    }
    QUERY_SEQ="";
    SUBJ_SEQ="";
    SUBJ_START=9999999;
    SUBJ_END= -1;
}

/^  Database:/ {
    if (QUERY_START<QUERY_END) {
	print_hit();
    }
}

/Identities =/ {
    IDENTITY_PERCENT=substr($4,2);
    IDENTITY_PERCENT=substr(IDENTITY_PERCENT,1,index(IDENTITY_PERCENT,"%")-1);
}

/^ Frame =/ {
    BLAST_FRAME=$3;
}

/^ Strand = / {
    if ($5=="Plus") {
	BLAST_FRAME="+1";
    }
    else if ($5=="Minus") {
	BLAST_FRAME="-1";
    }
}

/^Query:/ {
    if ($2<QUERY_START) {
	QUERY_START=$2;
    }
    if ($4<QUERY_START) {
	QUERY_START=$4;
    }
    if ($2>QUERY_END) {
	QUERY_END=$2;
    }
    if ($4>QUERY_END) {
	QUERY_END=$4;
    }
    QUERY_SEQ=QUERY_SEQ $3;
}

/^Sbjct:/ {
    if ($2<SUBJ_START) {
	SUBJ_START=$2;
    }
    if ($4<SUBJ_START) {
	SUBJ_START=$4;
    }
    if ($2>SUBJ_END) {
	SUBJ_END=$2;
    }
    if ($4>SUBJ_END) {
	SUBJ_END=$4;
    }
    SUBJ_SEQ=SUBJ_SEQ $3;
}

error: pathspec 'parse_blast.awk' did not match any file(s) known to git


checkFile: check for copyright 2014; more liberal check for spaces after import.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/citycloud-bigdata/mondrian.git/'


fixed bug #52, invalid operator |&

fixed bug #52, invalid operator |&


print "try 2.1 for FTP"

print "try 2.1 for FTP"

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/svnpenn/sage.git/'


add truecolortest.awk

add truecolortest.awk

#!/usr/bin/awk -f
# a simple script to test 24 bit compatibility in a terminal
# source: https://gist.github.com/XVilka/8346728
BEGIN{
    s="/\\/\\/\\/\\/\\"; s=s s s s s s s s;
    for (colnum = 0; colnum<77; colnum++) {
        r = 255-(colnum*255/76);
        g = (colnum*510/76);
        b = (colnum*255/76);
        if (g>255) g = 510-g;
        printf "\033[48;2;%d;%d;%dm", r,g,b;
        printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
        printf "%s\033[0m", substr(s,colnum+1,1);
    }
    printf "\n";
}

error: pathspec 'truecolortest.awk' did not match any file(s) known to git


Added awk script to split FASTA file into codons

#!/usr/bin/awk -f

BEGIN{
    RS=">";
    FS ="\n";
    OFS=""
    ORS=""
    if (ARGC < 3){
	print "usage: awk  [INFILE] [codon number] > outfile";
	exit 1
	}
    c = ARGV[2]
    print c
    delete ARGV[2];
}
{
    if (NF > 1){
	i = c;
	print ">"$1 "\n"
	sl=length($2);
	while( i <= sl ){
	    print substr($2, i, 1)
	    i = i + 3;
	}
	print "\n"
    }
}

error: pathspec 'splitcodon.awk' did not match any file(s) known to git


add Translate (initial)

add Translate (initial)

#!/usr/bin/gawk -f

@include "lib/Commons"
@include "lib/PLTokenizer"
@include "lib/PLParser"

# Get the translation of a string.
function getTranslation(text, sl, tl, hl,
                        isVerbose, toSpeech, returnPlaylist,
                        ####
                        altTranslations, article, ast, content,
                        explanation, group, i, il,
                        isPhonetic, j, original, phonetics,
                        r, rtl, saveSortedIn, segments,
                        temp, tokens, translation, translations,
                        word, words, wordClasses) {
    isPhonetic = match(tl, /^@/)
    tl = substr(tl, 1 + isPhonetic)

    if (!getCode(tl)) {
        # Check if target language is supported
        w("[WARNING] Unknown target language code: " tl)
    } else if (rtl = Locale[getCode(tl)]["rtl"]) {
        # Check if target language is RTL
        if (!FriBidi)
            w("[WARNING] " Locale[getCode(tl)]["name"] " is a right-to-left language, but GNU FriBidi is not found on your system.\nText might be displayed incorrectly.")
    }

    content = getResponse(text, sl, tl, hl)

    plTokenize(tokens, content)
    plParse(ast, tokens)

    if (!anything(ast)) {
        e("[ERROR] Oops! Something went wrong and I can't translate it for you :(")
        ExitCode = 1
    }

    # Debug mode
    if (Option["debug"]) {
        d(sprintf("content='%s'", content))
        da(tokens, "tokens[%s]='%s'")
        da(ast, "ast[%s]='%s'")
    }

    saveSortedIn = PROCINFO["sorted_in"]
    PROCINFO["sorted_in"] = "@ind_num_asc"
    for (i in ast) {
        if (i ~ "^0" SUBSEP "0" SUBSEP "[[:digit:]]+" SUBSEP "0$")
            append(translations, postprocess(literal(ast[i])))
        if (i ~ "^0" SUBSEP "0" SUBSEP "[[:digit:]]+" SUBSEP "1$")
            append(original, literal(ast[i]))
        if (i ~ "^0" SUBSEP "0" SUBSEP "[[:digit:]]+" SUBSEP "2$")
            append(phonetics, literal(ast[i]))

        if (match(i, "^0" SUBSEP "1" SUBSEP "([[:digit:]]+)" SUBSEP "0$", group))
            wordClasses[group[1]] = literal(ast[i])

        if (match(i, "^0" SUBSEP "1" SUBSEP "([[:digit:]]+)" SUBSEP "2" SUBSEP "([[:digit:]]+)" SUBSEP "([[:digit:]]+)$", group))
            words[group[1]][group[2]][group[3]] = literal(ast[i])
        if (match(i, "^0" SUBSEP "1" SUBSEP "([[:digit:]]+)" SUBSEP "2" SUBSEP "([[:digit:]]+)" SUBSEP "1" SUBSEP "([[:digit:]]+)$", group))
            words[group[1]][group[2]]["1"][group[3]] = literal(ast[i])

        if (match(i, "^0" SUBSEP "5" SUBSEP "([[:digit:]]+)" SUBSEP "0$", group))
            segments[group[1]] = literal(ast[i])

        if (match(i, "^0" SUBSEP "5" SUBSEP "([[:digit:]]+)" SUBSEP "2" SUBSEP "([[:digit:]]+)" SUBSEP "0$", group))
            altTranslations[group[1]][group[2]] = postprocess(literal(ast[i]))

        # Identified source languages
        if (i ~ "^0" SUBSEP "8" SUBSEP "0" SUBSEP "[[:digit:]]+$")
            append(il, literal(ast[i]))
    }
    PROCINFO["sorted_in"] = saveSortedIn

    translation = join(translations)

    if (!anything(il)) il[0] = sl

    # Generate output
    if (!isVerbose) {
        # Brief mode

        r = isPhonetic && anything(phonetics) ?
            join(phonetics) :  # phonetic transcription
            s(translation, tl) # target language

        if (toSpeech) {
            returnPlaylist[0]["text"] = translation
            returnPlaylist[0]["tl"] = tl
        }

    } else {
        # Verbose mode

        r = AnsiCode["bold"] s(translation, tl) AnsiCode["no bold"] # target language
        if (anything(phonetics))
            r = r "\n" AnsiCode["bold"] join(phonetics) AnsiCode["no bold"] # phonetic transcription

        if (anything(altTranslations[0])) {
            # List alternative translations

            if (Locale[getCode(hl)]["rtl"] || Locale[getCode(il[0])]["rtl"])
                r = r "\n\n" s(sprintf(Locale[getCode(hl)]["message"], join(original))) # caution: mixed languages, BiDi invoked must be implemented correctly (i.e. FriBidi is required)
            else
                r = r "\n\n" sprintf(Locale[getCode(hl)]["message"], join(original))
            if (Locale[getCode(il[0])]["rtl"] || Locale[getCode(tl)]["rtl"])
                r = r "\n" s("(" Locale[getCode(il[0])]["endonym"] " ➔ " Locale[getCode(tl)]["endonym"] ")") # caution: mixed languages
            else
                r = r "\n" "(" Locale[getCode(il[0])]["endonym"] " ➔ " Locale[getCode(tl)]["endonym"] ")"

            temp = segments[0] "(" join(altTranslations[0], "/") ")"
            for (i = 1; i < length(altTranslations); i++)
                temp = temp " " segments[i] "(" join(altTranslations[i], "/") ")"
            if (Locale[getCode(il[0])]["rtl"] || Locale[getCode(tl)]["rtl"])
                r = r "\n" AnsiCode["bold"] s(temp) AnsiCode["no bold"] # caution: mixed languages
            else
                r = r "\n" AnsiCode["bold"] temp AnsiCode["no bold"]
        }

        if (anything(wordClasses)) {
            # List dictionary entries

            for (i = 0; i < length(words); i++) {
                r = r "\n\n" s("[" wordClasses[i] "]", hl) # home language
                for (j = 0; j < length(words[i]); j++) {
                    word = words[i][j][0]
                    explanation = join(words[i][j][1], ", ")
                    article = words[i][j][4]

                    if (rtl) {
                        r = r "\n" AnsiCode["bold"] sprintf("%" Option["width"] - 4 "s", s((article ?
                                                                                "(" article ")" :
                                                                                "") " " word, tl, Option["width"] - 4)) AnsiCode["no bold"] # target language
                        r = r "\n" s(explanation, il[0], Option["width"] - 8) # identified source language
                    } else {
                        r = r "\n" "    " AnsiCode["bold"] show((article ?
                                                                 "(" article ") " :
                                                                 "") word, tl) AnsiCode["no bold"] # target language
                        r = r "\n" "        " s(explanation, il[0], Option["width"] - 8) # identified source language
                    }
                }
            }
        }

        if (toSpeech) {
            if (index(Locale[getCode(hl)]["message"], "%s") > 2) {
                returnPlaylist[0]["text"] = sprintf(Locale[getCode(hl)]["message"], "")
                returnPlaylist[0]["tl"] = hl
                returnPlaylist[1]["text"] = join(original)
                returnPlaylist[1]["tl"] = il[0]
            } else {
                returnPlaylist[0]["text"] = join(original)
                returnPlaylist[0]["tl"] = il[0]
                returnPlaylist[1]["text"] = sprintf(Locale[getCode(hl)]["message"], "")
                returnPlaylist[1]["tl"] = hl
            }
            returnPlaylist[2]["text"] = translation
            returnPlaylist[2]["tl"] = tl
        }
    }

    return r
}

error: pathspec 'lib/Translate.awk' did not match any file(s) known to git


use return instead of exit in main to avoid a warning

git-svn-id: 193148810cf65385f3a195dbc9a8b504846da3a2@8941 ec53bebd-3082-4978-b11e-865c3cabbd6b

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/madscientist159/heimdal.git/'


add missing file - fix build breakage

add missing file - fix build breakage

#
# /**********************************************************
# *      This software is part of the graphviz package      *
# *                http://www.graphviz.org/                 *
# *                                                         *
# *            Copyright (c) 1994-2005 AT&T Corp.           *
# *                and is licensed under the                *
# *            Common Public License, Version 1.0           *
# *                      by AT&T Corp.                      *
# *                                                         *
# *        Information and Software Systems Research        *
# *              AT&T Research, Florham Park NJ             *
# **********************************************************/
#
# Convert SVG-1.1 color data to same RGBA format used in color_names.
# See svgcolor_names for input format.
#
# All colors assumed opaque, so A = 255 in all colors
BEGIN {
	FS = "[ ,()]*";
}
/^[ 	]*$/    { next; }
/^#/    { next; }
{
	printf ("/svg/%s %s %s %s 255\n", $1, $5, $6, $7);
}

error: pathspec 'awk/svgcolor.awk' did not match any file(s) known to git


Se quitan comentarios

Se quitan comentarios

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/interwaremx/Caudal.git/'


Add tool to extract options from configure help output

error: pathspec 'tool/extract-configure-options.awk' did not match any file(s) known to git


added missing processdelivered.awk script

#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenOffice.org is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License version 3 for more details
# (a copy is included in the LICENSE file that accompanied this code).
#
# You should have received a copy of the GNU Lesser General Public License
# version 3 along with OpenOffice.org.  If not, see
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
#*************************************************************************

BEGIN {
    RS=" "
    FS=":"
}

NF == 2 {
    print "COPY " $1 " " $2;
}

error: pathspec 'solenv/gbuild/processdelivered.awk' did not match any file(s) known to git


Create zad11.awk

Create zad11.awk

#Z pliku telefony.txt wypisać imiona i nazwiska wszystkich osób, których telefony zaczynają się od 058.

$NF ~ /^058/ {print $2" "$1}

error: pathspec 'AWK/zad11.awk' did not match any file(s) known to git


add tool.subCh

add tool.subCh

BEGIN{
    # base parameter
    dnbs = 1e7;
    tpbs = 1e8;
    vxbs = 0.;
    # hotspot parameter
    xdis = 1e7;
    tdis = 3e9;

    xmax = 1e8;
    nmax = 800;

    dx   = 2 * xmax / nmax;
    for(i = 0; i < nmax; i++) {
        px = dx * i - xmax;
        if(px*px < xdis*xdis) {
            dn = dnbs;
            vx = vxbs;
            xx = (px > 0.) ? px : -px;
            tp = tdis - (tdis - tpbs) * (xx / xdis) + tpbs;
        } else {
            dn = dnbs;
            vx = vxbs;
            tp = tpbs;
        }
        printf("%+e %+e %+e %+e\n", px, dn, tp, vx);
    }
}

error: pathspec 'tool.subCh/makeInit.awk' did not match any file(s) known to git


a_new(dc, "sage-spy.awk <timeout>", "", "try 2.1 for FTP"


adding my gpxutil iso date conversion script

#!/usr/bin/env gawk -f

# script to convert garmin gpx files's comment/description field's
# silly DD-MMM-YY format to ISO date format, so native ascii order
# will sort waypoints by the time they are created.
#
# from: <cmt>05-JUL-13 16:34:05</cmt>
#   to: <cmt>2013-07-05 16:34:05</cmt>

BEGIN {
    # use < or > as field separator for XML content
    FS = "[<>]"

    # we are only interested in these lines
    p_line = "<cmt>|<desc>"

    # regex pattern for the timestamp garmin outputs
    # 05-JUL-13 16:34:05
    # the hour can be one digit, so we group it separately
    p_date = "([0-9]{2})-([a-zA-Z]{3})-([0-9]{2}) ([0-9]{1,2}):([0-9]{2}:[0-9]{2})"

    # create the month['jan'] = '01' ... array
    build_month()
}

# print non matching lines (implicit action)
$0 !~ p_line

# matching lines, convert matching timestamp
$0 ~ p_line {
    date = $3  # get the date we are interested in

    if (match(date, p_date, A)) {
        new_date = sprintf("20%s-%s-%s %02d:%s",  # assumes > year 2000
                           A[3],
                           month[tolower(A[2])],
                           A[1],
                           A[4],
                           A[5])
        # print date " -> " new_date
        # replace date with new_date in line
        sub(date, new_date, $0)
        count++
    }
    print
}

END {
    print FILENAME ":", count, "line(s) update." > "/dev/stderr"
}

# create the month['jan'] = '01' ... array
function build_month(   i, n, mlist)
{
    # parameters are used as local vars, no need to pass it in
    n = split("jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec", mlist, "|")
    for (i = 1; i <= n; i++) {
        month[mlist[i]] = sprintf("%02d", i)
    }
}

# var initializes to 0 or "" as appropriate depend on use.
# so basically no need to initialize variables

error: pathspec 'gpx/iso-date/src/gpxutil.awk' did not match any file(s) known to git


Add utility to check proper scheduling of SI

There are several types of System Information messages with tricky
scheduling rules described in 3GPP TS 05.02 § 6.3.1.3. This GNU Awk
script takes in .csv file with sequence of scheduled SI messages (for
example generated using tshark from GSMTAP capture - see usage note
inside the script) and check the scheduling rules compliance.

#!/usr/bin/gawk -f

# Usage example:
# tshark -2 -t r -E 'header=n' -E 'separator=,' -E 'quote=n' -T fields -e gsmtap.frame_nr -e gsmtap.ts -e gsmtap.arfcn -e _ws.col.Info -Y 'gsmtap' -r test.pcapng.gz | grep Information | env ARFCN=878 ./si_check.gawk
# read summary on number of bis/ter messages and adjust BT_BOTH and BT_NONE environment variables accordingly

BEGIN {
	FS = ","
	FAILED = 0
	IGNORE = 0
	BIS = 0
	TER = 0
	QUA = 0
	BT_BOTH = ENVIRON["BOTH"]
	BT_NONE = ENVIRON["NONE"]
	TC_INDEX = 0
	TC4[4] = 0
}

{ # expected .csv input as follows: gsmtap.frame_nr,gsmtap.ts,gsmtap.arfcn,_ws.col.Info
	if ("ARFCN" in ENVIRON) { # ARFCN filtering is enabled
		if (ENVIRON["ARFCN"] != $3) { # ignore other ARFCNs
			IGNORE++
			next
		}
	}
	type = get_si_type($4)
	tc = get_tc($1)
	result = "FAIL"

	if (1 == check_si_tc(tc, type)) { result = "OK" }
	else { FAILED++ }

	if (4 == tc) {
		TC4[TC_INDEX] = type
		TC_INDEX = int((TC_INDEX + 1) % 4)
		if (0 == check_tc4c(type) && "OK" == result) {
			result = "FAIL"
			FAILED++
		}
	}
	if (type == "2bis") { BIS++ }
	if (type == "2ter") { TER++ }
	if (type == "2quater") { QUA++ }
	# for (i in TC4) print TC4[i] # debugging
	printf "ARFCN=%d FN=%d TS=%d TC=%d TYPE=%s %s\n", $3, $1, $2, tc, type, result
}

END {
	printf "check completed: total %d, failed %d, ignored %d, ok %d\nSI2bis = %d, SI2ter = %d, SI2quater = %d\n", NR, FAILED, IGNORE, NR - FAILED - IGNORE, BIS, TER, QUA
	if ((BIS > 0 || TER > 0) && BT_NONE) { printf "please re-run with correct environment: unset 'NONE' variable\n" }
	if ((BIS > 0 && TER > 0) && !BT_BOTH) { printf "please re-run with correct environment: set 'BOTH' variable\n" }
}

func get_si_type(s, x) { # we rely on format of Info column in wireshark output - if it's changed we're screwed
	return x[split(s, x, " ")]
}

func get_tc(f) { # N. B: all numbers in awk are float
	return int(int(f / 51) % 8)
}

func check_tc4c(si, count) { # check for "once in 4 consecutive occurrences" rule
	count = 0
	if ("2quater" != si || "2ter" != si) { return 1 } # rules is not applicable to other types
	if (BT_NONE && "2quater" == si) { return 0 } # should be on TC=5 instead
	if (!BT_BOTH && "2ter" == si) { return 0 } # should be on TC=5 instead
	if (0 in TC4 && 1 in TC4 && 2 in TC4 && 3 in TC4) { # only check if we have 4 consecutive occurrences already
		if (si == TC4[0]) { count++ }
		if (si == TC4[1]) { count++ }
		if (si == TC4[2]) { count++ }
		if (si == TC4[3]) { count++ }
		if (0 == count) { return 0 }
	}
	return 1
}

func check_si_tc(tc, si) { # check that SI scheduling on BCCH Norm is matching rules from 3GPP TS 05.02 § 6.3.1.3
	switch (si) {
	case "1":       return (0 == tc) ? 1 : 0
	case "2":       return (1 == tc) ? 1 : 0
	case "2bis":    return (5 == tc) ? 1 : 0
	case "13":      return (4 == tc) ? 1 : 0
	case "9":       return (4 == tc) ? 1 : 0
	case "2ter":    if (BT_BOTH) { return (4 == tc) ? 1 : 0 } else { return (5 == tc) ? 1 : 0 }
	case "2quater": if (BT_NONE) { return (5 == tc) ? 1 : 0 } else { return (4 == tc) ? 1 : 0 }
	case "3":       return (2 == tc || 6 == tc) ? 1 : 0
	case "4":       return (3 == tc || 7 == tc) ? 1 : 0
	}
	return 0
}

error: pathspec 'contrib/si_check.gawk' did not match any file(s) known to git


builtin

builtin

#! /bin/awk -f

#find mean and variance of a column from a file
BEGIN {
}
#body
{
   alen=length($2)
   if (alen >= 29)
      print $2, alen
}
END {
}

error: pathspec 'src/awk/builtin.awk' did not match any file(s) known to git


Separate awk script.

Separate awk script.

Separate awk script.

#! /usr/bin/awk

BEGIN {
  DISKS    = 0;
  NICS     = 0;
  CSECTION = "";
}

/^[ \ta-zA-Z0-9_-+!@$%^&\\\/.:]+/ {
  pos   = index($0, "=");
  if (pos > 0)
  {
	left  = substr($0, 1, pos - 1);
	right = substr($0, pos + 1, length($0) - pos);
	gsub("^[ \t]+" ,"", left);
	gsub("[ \t]+$" ,"", left);
	gsub("^[ \t]+" ,"", right);
	gsub("[ \t]+$" ,"", right);
	left = tolower(left);
	if (match(CSECTION, "disk") > 0)
	{
	  left = sprintf("%s[%d]", left, DISKS);
	}
	if (match(CSECTION, "network") > 0)
	{
	  left = sprintf("%s[%d]", left, NICS);
	}
	printf ("%s_%s=%s\n", CSECTION, left, right);
  }
}

/^[ \t]*\[[a-zA-Z0-9_-+!@$%^&\\\/.:]+/ {
  gsub("^[ \t]+" ,"", $1);
  gsub("[ \t]+$" ,"", $1);
  gsub("^\[" ,"", $1);
  gsub("\]$" ,"", $1);
  CSECTION = $1;
  if (match(CSECTION,"disk") > 0)
  {
	DISKS = DISKS + 1;
  }
  if (match(CSECTION, "network") > 0)
  {
	NICS = NICS + 1;
  }
}

error: pathspec 'vmvar.awk' did not match any file(s) known to git


Use waas cache on Advanced page

Use waas cache on Advanced page

#!/usr/bin/awk -f
BEGIN {
  NUM_ASIC = 6;
  NUM_DIE = 4;
  NUM_DCDC = 8;
  for (asic = 0; asic < NUM_ASIC; ++asic) {
    asic_temp[asic] = "";
    asic_type[asic] = "OFF";
    for (die = 0; die < NUM_DIE; ++die) {
      asic_freq[asic, die] = 0;
    }
    for (dcdc = 0; dcdc < NUM_DCDC; ++dcdc)
      asic_dcdctemp[asic, dcdc] = "";
  }
  cur_asic = 0;
 }

/ASICCACHE/ { asic = $2;
  asic_type[asic] = $3;
  asic_temp[asic] = $4;
  for (die = 0; die < NUM_DIE; ++die) {
    asic_freq[asic, die] = $(5 + die*2);
    asic_volt[asic, die] = $(5 + die*2 + 1);
  }
  for (dcdc = 0; dcdc < NUM_DCDC; ++dcdc) {
    asic_dcdctemp[asic, dcdc] = $(5 + NUM_DIE*2 + dcdc*3);
    asic_dcdcVout[asic, dcdc] = $(5 + NUM_DIE*2 + dcdc*3 + 1);
    asic_dcdcIout[asic, dcdc] = $(5 + NUM_DIE*2 + dcdc*3 + 2);
  }
}

END {
  print "{"
  for (asic = 0; asic < NUM_ASIC; ++asic) {
    num = asic + 1;
    printf("\"asic_%d\": {\n", num);

    for (dcdc = 0; dcdc < NUM_DCDC; ++dcdc) {
      vout = "";
      if ("" != asic_dcdcVout[asic, dcdc])
        vout = (0.0 + asic_dcdcVout[asic, dcdc]);
      if (vout <= 0)
        vout_s = "";
      else
        vout_s = sprintf("%.4f", vout);
      print "\t\"dcdc" dcdc "_Vout\": \"" vout_s "\","

      iout = "";
      if ("" != asic_dcdcIout[asic, dcdc])
        iout = (0.0 + asic_dcdcIout[asic, dcdc]);
      if (iout <= 0)
        iout_s = "";
      else
        iout_s = sprintf("%.4f", iout);
      print "\t\"dcdc" dcdc "_Iout\": \"" iout_s "\","

      temp = "";
      if ("" != asic_dcdctemp[asic, dcdc])
        temp = (0.0 + asic_dcdctemp[asic, dcdc]);
      if (temp <= 0)
        temp_s = "";
      else
        temp_s = sprintf("%.1f", temp);
      print "\t\"dcdc" dcdc "_Temp\": \"" temp_s "\","
    }

    for (die = 0; die < NUM_DIE; ++die) {
      freq = "";
      if ("" != asic_freq[asic, die])
        freq = (0 + asic_freq[asic, die]);
      if (freq <= 0)
        freq = "";
      print "\t\"die" die "_Freq\": \"" freq "\",";

      volt = "";
      if ("" != asic_volt[asic, die])
        volt = (0.0 + asic_volt[asic, die]);
      if (volt <= -1000)
        volt_s = "";
      else
        volt_s = sprintf("%.4f", volt);
      print "\t\"die" die "_Voffset\": \"" volt_s "\",";
    }

    temp = "";
    if ("" != asic_temp[asic])
      temp = (0.0 + asic_temp[asic]);
    if (temp <= 0)
      temp_s = "";
    else
      temp_s = sprintf("%.1f", temp);
    print "\t\"temperature\": \"" temp_s "\"";

    if (asic < (NUM_ASIC - 1))
      print "},"
    else
      print "}"
  }
  print "}"
}

error: pathspec 'RPi_system/waas_all_info_cached.awk' did not match any file(s) known to git


pushing

pushing

# vim: ft=awk:ts=2 sw=2 sts=2 expandtab:cindent:formatoptions+=cro

@include "lib"

BEGIN {
  data(d)
  Csv(d,"data/weather" The.dot "csv")
  _ISORTER=3
  asort(d.rows,_,"isort_cmp")
  o(d.rows)
}

error: pathspec 'auk/libOk.auk' did not match any file(s) known to git


Histogram awk script

Histogram awk script

#!/usr/bin/env awk -f

# draws histogram for a reverse sorted count file

NR == 1 {
    width = 60
    max = $1;
}
{
    title = $2;
    size = width * ($1 / max);

    bar = "";
    for (i = 0; i < size; i++)
        bar = bar"#";

    count = sprintf("(%d)", $1);
    printf "%-10s %10s %s\n", title, count, bar;
}

error: pathspec 'bin/histogram.awk' did not match any file(s) known to git


s_split("/", url, br)

s_split("/", url, br)

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/svnpenn/sage.git/'


add first version of parser (AWK ftw)

add first version of parser (AWK ftw)

#!/usr/bin/awk -f

function parse(string, ss, toks, f) {

   if(index(string, "(") != 0) {
      match(string, /(.*)\(([^()]+)\)(.*)/, ss);
      toparse = ss[1] parse(ss[2]) ss[3];
      return parse(toparse);
   }

   if(index(string, " or ") != 0) {
      match(string, /(.*) or (.*)/, ss);
      return "max[" parse(ss[1]) "," parse(ss[2]) "]";
   }

   if(index(string, " and ") != 0) {
      match(string, /(.*) and (.*)/, ss);
      return "min[" parse(ss[1]) "," parse(ss[2]) "]";
   }

   if(index(string, "min[") == 0 && index(string, "max[") == 0)
      return "f{\""string"\"}";
   else
      return string;
}

{
   split($0,ss," => ");
   header = "Fitness rule"++n"(Fitnesses f) {";
   result = parse(ss[1]);
   gsub(/\[/,"(",result);
   gsub(/\]/,")",result);
   gsub(/\{/,"[",result);
   gsub(/\}/,"]",result);
   body = "\t return " result ";";
   print header "\n" body "\n}\nrules[\"" ss[2] "\"] = rule" n ";";
}

error: pathspec 'parser.awk' did not match any file(s) known to git


Add anm3 config

Add anm3 config

@include "anm3.awk"

/+1$/ {
	magic_key("Home")
}

/+2$/ && W_COMMAND !~ /Discord/ {
	magic_key("End")
}

/+2$/ && W_COMMAND ~ /Discord/ {
	key("Escape") # Go to newest message and mark unread.
}

/+2$/ && W_TITLE ~ /Minecraft/ {
	key("F5 F5") # Look behind character.
}

/-2$/ && W_TITLE ~ /Minecraft/ {
	key("F5")
}

/-3$/ && W_COMMAND ~ /Discord/ {
	key("Shift+Prior")
}

/+4$/ {
	MINIMIZE_WIN = W_TITLE " " W_COMMAND
}

/-4$/ {
	if (MINIMIZE_WIN == W_TITLE " " W_COMMAND) {
		xdo("getactivewindow windowminimize") # Iconify window.
	}
}

/-7$/ && W_COMMAND ~ /firefox|chrom/ {
	key("Ctrl+Shift+t")
}

/+10$/ && W_COMMAND ~ /firefox|chrom/ { # Works for firefox, chrome, and chromium
	key("Ctrl+w") # Close Tab
}

/+10$/ && W_COMMAND ~ /Discord/ {
	if (W_TITLE ~ /^Discord$/) {
		# xdo("getactivewindow windowclose") # Discord can't be reopened?
	} else {
		key("Ctrl+1 Ctrl+1") # Switch to start screen
	}
}

/+10$/ && W_TITLE ~ /Terminal - man/ {
	key("q") # quit man
}

/+10$/ && W_TITLE ~ /Terminal - (fish|.*@grant-arch-desk-1:)/ {
	xdo("getactivewindow windowclose") # close window
}

/+10$/ && W_COMMAND ~ /mirage/ {
	xdo("getactivewindow windowclose") # close window
}

/+10$/ && W_COMMAND ~ /pcmanfm/ {
	key("Ctrl+w")
}

/+10$/ && W_TITLE ~ /^Terminal - .* - VIM$/ {
	key("Escape")
	type(":q")
	key("Return")
}

/+11$/ {
	magic_key("XF86Back")
}

/+12$/ {
	magic_key("XF86Forward")
}

error: pathspec 'anm3rc.awk' did not match any file(s) known to git


recognize partial register operands in i386 CFI generation

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/chardi/musl.git/'


adding in addstats script for mega

adding in addstats script for mega

#!/usr/bin/awk -f
##########
#The MIT License (MIT)
#
# Copyright (c) 2015 Aiden Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#  THE SOFTWARE.
##########
# Helper script for taking in multiple inter.txt and producing sums
# Juicer version 1.5
$1=="Sequenced"{
gsub(/,/,"",$4);
 total=total+$4;
}
$1=="Unmapped:"{
gsub(/,/,"",$2);
 unmapped=unmapped+$2
}
$1=="Normal"{
gsub(/,/,"",$3);
 regular=regular+$3}
$1=="Chimeric" && $2=="Paired:"{
gsub(/,/,"",$3);
 normal=normal+$3}
$2=="Ambiguous:"{
gsub(/,/,"",$3);
 abnorm=abnorm+$3}
$1=="Alignable"{
gsub(/,/,"",$4);
 alignable=alignable+$4}
$1=="Unique" {
gsub(/,/,"",$3);
 dedup=dedup+$3}
$1=="PCR"{
gsub(/,/,"",$3);
 dups=dups+$3}
$1=="Optical"{
gsub(/,/,"",$3);
 optdups=optdups+$3}
END{
 printf("%s %'d\n", "Sequenced Read Pairs:", total);
 printf(" %s %'d (%0.2f%)\n", "Normal Paired:", regular, regular*100/total);
 printf(" %s %'d (%0.2f%)\n", "Chimeric Paired:", normal, normal*100/total);
 printf(" %s %'d (%0.2f%)\n", "Chimeric Ambiguous:", abnorm, abnorm*100/total);
 printf(" %s %'d (%0.2f%)\n", "Unmapped:", unmapped, unmapped*100/total);
 printf(" %s %'d (%0.2f%)\n", "Alignable (Normal+Chimeric Paired):", alignable, alignable*100/total);
 printf("%s %'d\n", "Unique Reads:", dedup);
 printf("%s %'d\n", "PCR Duplicates:", dups);
  printf("%s %'d\n", "Optical Duplicates:", optdups);
}

error: pathspec 'CPU/common/makemega_addstats.awk' did not match any file(s) known to git


Add cubic_roots.awk

Add cubic_roots.awk

1. Awk script to compute zeros of a cubic function.

BEGIN{
    pi = atan2(1,1)*4.0
}{
    # Solve for x given a3*x^3 + a2*x^2 + a1*x +a0 = 0
    # Input is: a3 a2 a1 a0
    a3 = $1
    a2 = $2
    a1 = $3
    a0 = $4

    # Normalize equation so that a3 = 1
    a0 = a0/a3
    a1 = a1/a3
    a2 = a2/a3
    a3 = a3/a3

    Q = (3*a1-a2*a2)/9
    R = (9*a2*a1-27*a0-2*a2*a2*a2)/54

    D = Q*Q*Q + R*R

    # Depending on number of roots, calculate differently
    if (D<=0) {
        print "D<=0: ",D
        x = R/sqrt(-Q*Q*Q)
        theta = atan2(sqrt(1-x*x), x)
        x1 = 2*sqrt(-Q)*cos(theta/3) - a2/3
        x2 = 2*sqrt(-Q)*cos((theta+2*pi)/3) - a2/3
        x3 = 2*sqrt(-Q)*cos((theta+4*pi)/3) - a2/3
        print x1,x2,x3
    } else {
        print "D POSITIVE: ",D
        S = (R+sqrt(D))^(1/3)
        T = (R-sqrt(D))^(1/3)
        x1 = S + T - a2/3
        print x1
    }
}END{

}

error: pathspec 'scripts/cubic_roots.awk' did not match any file(s) known to git


Added an awk script to check for leaks in the memory logging output we just added.

# 7 april 2015

$2 == "alloc" {
	if ($1 in A) {
		problem($1 " already allocated (" A[$1] "); allocated at " NR)
		next
	}
	A[$1] = type()
	next
}

$2 == "realloc" {
	if (!($1 in A)) {
		problem($1 " not yet allocated; reallocated at " NR)
		next
	}
	if ($3 in A) {
		problem($3 " already allocated (" A[$3] "); reallocated at " NR)
		next
	}
	t = A[$1]
	delete A[$1]
	A[$3] = t
	next
}

$2 == "free" {
	if (!($1 in A)) {
		problem($1 " not yet allocated; freed at " NR)
		next
	}
	delete A[$1]
	next
}

{ problem("unrecognized line " $0 " at " NR) }

END {
	for (i in A)
		problem("leaked " A[i] " at " i)
	close("/dev/stderr")
	if (hasProblems)
		exit 1
}

function problem(s) {
	print s > "/dev/stderr"
	hasProblems = 1
}

function type(		s, i) {
	s = $3
	for (i = 4; i <= NF; i++)
		s = s " " $i
	return s
}

error: pathspec 'leaks.awk' did not match any file(s) known to git


print "try 2 for FTP"

print "try 2 for FTP"


ARM: SAMSUNG: Add script to change old clksrc_clk to new register defs

This script is used to change the old style clksrc_clk as originally
found in plat-s3c64xx to the new style. It is here for reference if needed
for future code merges.

Signed-off-by: Ben Dooks <1177f64998f284a7348354b8e91cbbe575d9858a@fluff.org>

#!/usr/bin/awk -f
#
# Copyright 2010 Ben Dooks <ben-linux@fluff.org>
#
# Released under GPLv2

# example usage
# ./clksrc-change-registers.awk arch/arm/plat-s5pc1xx/include/plat/regs-clock.h < src > dst

function extract_value(s)
{
    eqat = index(s, "=")
    comat = index(s, ",")
    return substr(s, eqat+2, (comat-eqat)-2)
}

function remove_brackets(b)
{
    return substr(b, 2, length(b)-2)
}

function splitdefine(l, p)
{
    r = split(l, tp)

    p[0] = tp[2]
    p[1] = remove_brackets(tp[3])
}

function find_length(f)
{
    if (0)
	printf "find_length " f "\n" > "/dev/stderr"

    if (f ~ /0x1/)
	return 1
    else if (f ~ /0x3/)
	return 2
    else if (f ~ /0x7/)
	return 3
    else if (f ~ /0xf/)
	return 4

    printf "unknown legnth " f "\n" > "/dev/stderr"
    exit
}

function find_shift(s)
{
    id = index(s, "<")
    if (id <= 0) {
	printf "cannot find shift " s "\n" > "/dev/stderr"
	exit
    }

    return substr(s, id+2)
}

BEGIN {
    if (ARGC < 2) {
	print "too few arguments" > "/dev/stderr"
	exit
    }

# read the header file and find the mask values that we will need
# to replace and create an associative array of values

    while (getline line < ARGV[1] > 0) {
	if (line ~ /\#define.*_MASK/ &&
	    !(line ~ /S5PC100_EPLL_MASK/) &&
	    !(line ~ /USB_SIG_MASK/)) {
	    splitdefine(line, fields)
	    name = fields[0]
	    if (0)
		printf "MASK " line "\n" > "/dev/stderr"
	    dmask[name,0] = find_length(fields[1])
	    dmask[name,1] = find_shift(fields[1])
	    if (0)
		printf "=> '" name "' LENGTH=" dmask[name,0] " SHIFT=" dmask[name,1] "\n" > "/dev/stderr"
	} else {
	}
    }

    delete ARGV[1]
}

/clksrc_clk.*=.*{/ {
    shift=""
    mask=""
    divshift=""
    reg_div=""
    reg_src=""
    indent=1

    print $0

    for(; indent >= 1;) {
	if ((getline line) <= 0) {
	    printf "unexpected end of file" > "/dev/stderr"
	    exit 1;
	}

	if (line ~ /\.shift/) {
	    shift = extract_value(line)
	} else if (line ~ /\.mask/) {
	    mask = extract_value(line)
	} else if (line ~ /\.reg_divider/) {
	    reg_div = extract_value(line)
	} else if (line ~ /\.reg_source/) {
	    reg_src = extract_value(line)
	} else if (line ~ /\.divider_shift/) {
	    divshift = extract_value(line)
	} else if (line ~ /{/) {
		indent++
		print line
	    } else if (line ~ /}/) {
	    indent--

	    if (indent == 0) {
		if (0) {
		    printf "shift '" shift   "' ='" dmask[shift,0] "'\n" > "/dev/stderr"
		    printf "mask  '" mask    "'\n" > "/dev/stderr"
		    printf "dshft '" divshift "'\n" > "/dev/stderr"
		    printf "rdiv  '" reg_div "'\n" > "/dev/stderr"
		    printf "rsrc  '" reg_src "'\n" > "/dev/stderr"
		}

		generated = mask
		sub(reg_src, reg_div, generated)

		if (0) {
		    printf "/* rsrc " reg_src " */\n"
		    printf "/* rdiv " reg_div " */\n"
		    printf "/* shift " shift " */\n"
		    printf "/* mask " mask " */\n"
		    printf "/* generated " generated " */\n"
		}

		if (reg_div != "") {
		    printf "\t.reg_div = { "
		    printf ".reg = " reg_div ", "
		    printf ".shift = " dmask[generated,1] ", "
		    printf ".size = " dmask[generated,0] ", "
		    printf "},\n"
		}

		printf "\t.reg_src = { "
		printf ".reg = " reg_src ", "
		printf ".shift = " dmask[mask,1] ", "
		printf ".size = " dmask[mask,0] ", "

		printf "},\n"

	    }

	    print line
	} else {
	    print line
	}

	if (0)
	    printf indent ":" line "\n" > "/dev/stderr"
    }
}

// && ! /clksrc_clk.*=.*{/ { print $0 }

error: pathspec 'Documentation/arm/Samsung/clksrc-change-registers.awk' did not match any file(s) known to git


split out samples by animal

split out samples by animal

{
	if (line == 0) {
		for (i = 1; i <= NF; ++i) {
			header[i] = $i;
		}
		headers = NF;
	} else {
		if ($1 == "Donor")
			file = prefix ".Donor.tab";
		else
			file = prefix "." substr($1, 1, 2) ".tab";
		if (first[file] == 0) {
			first[file] = 1;
			printf("%s", header[1]) > file;
			for (i = 2; i <= headers; ++i)
				printf("\t%s", header[i]) >> file;
			printf("\n") >> file;
		}
		print $0 >> file;
	}
	line++;
}

error: pathspec '15.figures.ft.awk' did not match any file(s) known to git


A script to show per allocator overhead/fragmentation.

Can be used as follows:

  ./scripts/allocators.awk --(current|max|max-ever) erl_crash.dump.n_0.ns_server

Produces something that looks like this:

binary_alloc[0]

	mbcs size: 32872
	mbcs overhead: 7624
	mbcs fragmentation: 23

	sbcs size: 0
	sbcs overhead: 0
	sbcs fragmentation: 0

	combined size: 32872
	combined overhead: 7624
	combined fragmentation: 23
...
Top allocators by used memory:

	eheap_alloc[1]: 166645864
	ll_alloc: 37748800
	binary_alloc[4]: 13541480
	eheap_alloc[5]: 11784296
	eheap_alloc[4]: 10031208
	eheap_alloc[2]: 8900712
	eheap_alloc[3]: 8736872
	binary_alloc[2]: 8159336
	eheap_alloc[8]: 6922344
	binary_alloc[1]: 5537896

Top allocators by memory overhead:

	binary_alloc[2]: 5073408
	binary_alloc[4]: 4742216
	eheap_alloc[8]: 3658200
	eheap_alloc[1]: 3557856
	eheap_alloc[4]: 3447792
	eheap_alloc[2]: 2049672
	ll_alloc: 1886176
	eheap_alloc[3]: 1705592
	eheap_alloc[7]: 1666024
	binary_alloc[1]: 1120688

Top allocators by memory fragmentation:

	temp_alloc[1]: 100
	temp_alloc[2]: 100
	sl_alloc[0]: 100
	temp_alloc[4]: 100
	temp_alloc[6]: 100
	sl_alloc[4]: 100
	temp_alloc[8]: 100
	sl_alloc[6]: 100
	sl_alloc[7]: 100
	temp_alloc[0]: 100

Totals:

	mbcs size: 98508160
	mbcs overhead: 35793400
	mbcs fragmentation: 36

	sbcs size: 205307904
	sbcs overhead: 6765800
	sbcs fragmentation: 3

	combined size: 303816064
	combined overhead: 42559200
	combined fragmentation: 14

Change-Id: I6319826abac003619f9de0e52ae54858d3f73680
Reviewed-on: http://review.couchbase.org/50656
Tested-by: Aliaksey Artamonau <3c875bcfb3adf2a65b2ae7686ca921e6c9433147@gmail.com>
Reviewed-by: Aliaksey Artamonau <3c875bcfb3adf2a65b2ae7686ca921e6c9433147@gmail.com>

#!/usr/bin/gawk -f

BEGIN {
    type = "current"

    argc = 0

    for (i in ARGV) {
        if (match(ARGV[i], /--(max|max-ever|current)/, m)) {
            type = m[1]
        } else {
            argv[argc] = ARGV[i]
            argc += 1
        }
    }

    ARGC = argc
    for (i in argv) {
        ARGV[i] = argv[i]
    }

    if (type == "current") {
        size_index = 0
    } else if (type == "max") {
        size_index = 1
    } else if (type == "max-ever") {
        size_index = 2
    }
}

match($0, /=allocator:(.*)/, matches) {
    allocator = matches[1]
}

match($0, /(mbcs|sbcs) (blocks|carriers) size: ([[:digit:]]+) ([[:digit:]]+) ([[:digit:]]+)/, matches) {
    if (allocator) {
        allocators[allocator] = ""
        sizes[allocator "," matches[1] "," matches[2]] = matches[3 + size_index]
    }
}

END {
    total_mbcs_blocks = 0
    total_mbcs_carriers = 0

    total_sbcs_blocks = 0
    total_sbcs_carriers = 0

    PROCINFO["sorted_in"] = "@ind_str_asc"
    for (allocator in allocators) {
        mbcs_blocks = sizes[allocator ",mbcs,blocks"]
        mbcs_carriers = sizes[allocator ",mbcs,carriers"]

        sbcs_blocks = sizes[allocator ",sbcs,blocks"]
        sbcs_carriers = sizes[allocator ",sbcs,carriers"]

        mbcs_size[allocator] = mbcs_carriers
        mbcs_overhead[allocator] = mbcs_carriers - mbcs_blocks
        mbcs_fragmentation[allocator] = fragmentation(mbcs_overhead[allocator], mbcs_size[allocator])

        sbcs_size[allocator] = sbcs_carriers
        sbcs_overhead[allocator] = sbcs_carriers - sbcs_blocks
        sbcs_fragmentation[allocator] = fragmentation(sbcs_overhead[allocator], sbcs_size[allocator])

        total_mbcs_blocks += mbcs_blocks
        total_mbcs_carriers += mbcs_carriers
        total_sbcs_blocks += sbcs_blocks
        total_sbcs_carriers += sbcs_carriers

        combined_size[allocator] = mbcs_size[allocator] + sbcs_size[allocator]
        combined_overhead[allocator] = mbcs_overhead[allocator] + sbcs_overhead[allocator]
        combined_fragmentation[allocator] = fragmentation(combined_overhead[allocator],
                                                          combined_size[allocator])

        printf("%s\n\n", allocator)
        printf("\tmbcs size: %d\n", mbcs_size[allocator])
        printf("\tmbcs overhead: %d\n", mbcs_overhead[allocator])
        printf("\tmbcs fragmentation: %d\n\n", mbcs_fragmentation[allocator])
        printf("\tsbcs size: %d\n", sbcs_size[allocator])
        printf("\tsbcs overhead: %d\n", sbcs_overhead[allocator])
        printf("\tsbcs fragmentation: %d\n\n", sbcs_fragmentation[allocator])
        printf("\tcombined size: %d\n", combined_size[allocator])
        printf("\tcombined overhead: %d\n", combined_overhead[allocator])
        printf("\tcombined fragmentation: %d\n\n", combined_fragmentation[allocator])
    }

    total_mbcs_overhead = total_mbcs_carriers - total_mbcs_blocks;
    total_mbcs_fragmentation = fragmentation(total_mbcs_overhead, total_mbcs_carriers)

    total_sbcs_overhead = total_sbcs_carriers - total_sbcs_blocks;
    total_sbcs_fragmentation = fragmentation(total_sbcs_overhead, total_sbcs_carriers)

    total_blocks = total_mbcs_blocks + total_sbcs_blocks
    total_carriers = total_mbcs_carriers + total_sbcs_carriers
    total_overhead = total_carriers - total_blocks
    total_fragmentation = fragmentation(total_overhead, total_carriers)

    top(combined_size, top_size, 10)
    top(combined_overhead, top_overhead, 10)
    top(combined_fragmentation, top_fragmentation, 10)

    PROCINFO["sorted_in"] = "@val_type_desc"

    printf("Top allocators by used memory:\n\n")
    for (allocator in top_size) {
        printf("\t%s: %d\n", allocator, top_size[allocator])
    }

    printf("\n")

    printf("Top allocators by memory overhead:\n\n")
    for (allocator in top_overhead) {
        printf("\t%s: %d\n", allocator, top_overhead[allocator])
    }

    printf("\n")

    printf("Top allocators by memory fragmentation:\n\n")
    for (allocator in top_fragmentation) {
        printf("\t%s: %d\n", allocator, top_fragmentation[allocator])
    }

    printf("\n")
    printf("Totals:\n\n")
    printf("\tmbcs size: %d\n", total_mbcs_carriers)
    printf("\tmbcs overhead: %d\n", total_mbcs_overhead)
    printf("\tmbcs fragmentation: %d\n\n", total_mbcs_fragmentation)
    printf("\tsbcs size: %d\n", total_sbcs_carriers)
    printf("\tsbcs overhead: %d\n", total_sbcs_overhead)
    printf("\tsbcs fragmentation: %d\n\n", total_sbcs_fragmentation)
    printf("\tcombined size: %d\n", total_carriers)
    printf("\tcombined overhead: %d\n", total_overhead)
    printf("\tcombined fragmentation: %d\n\n", total_fragmentation)
}

function fragmentation(overhead, size) {
    if (size == 0) {
        return 0
    }

    return 100 * overhead / size
}

function top(arr, result, count) {
    PROCINFO["sorted_in"] = "@val_type_desc"

    for (allocator in arr) {
        result[allocator] = arr[allocator]

        count -= 1
        if (count <= 0) {
            break
        }
    }
}

error: pathspec 'scripts/allocators.awk' did not match any file(s) known to git


2008-01-02  Martin Sebor  <sebor@roguewave.com>

	* bin/xcomp.awk: Added a pattern to extract date formatted in the
	Windows format (the output of date /T).
	(get_date): Handled badly formatted/empty dates more robustly.
	(get_buildtype): Handled build types with the [redundant] "win32" bit
	indicating Windows threads.
	(print_section): Stripped the leading directory component from the log
	file name (the equivalent of basename).
	(print_section): Formatted empty date as "N/A".

git-svn-id: 1e8a4076bc3774682289f662a06025447996ff23@608297 13f79535-47bb-0310-9956-ffa450edef68

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/pathscale/stdcxx.git/'


sage-spy: FTP

sage-spy: FTP


Add Netflix specific link generator

Add Netflix specific link generator

# Helper for converting Netflix "viewing activity" into hyperlinks
#

# Death in Paradise: Season 6: "Man Overboard, Part 2"
# Ugly Delicious: Season 1: "Pizza"
# Hinterland: Season 3: "Episode 2"

# INVOCATION:
#    Browse to https://www.netflix.com/viewingactivity
#    Save as 'Page Source'
#    awk -f generateLinksFrom-NetflixActivityPage.awk ~/Downloads/Netflix.html

BEGIN {
    RS="\<"
    # print 10 records unless overridden with "-v maxRecordsToPrint=<n>"
    if (maxRecordsToPrint == "") maxRecordsToPrint = 10
}

/div class="col date nowrap"/ {
    split ($0,fld,">")
    date = fld[2]
}

/a href="\/title\// {
    split ($0,fld,">")
    title = fld[2]
    split ($0,fld,"\"")
    URL = fld[2]
    gsub (/"/,"",title)
    printf ("=HYPERLINK(\"https://www.netflix.com/%s\";\"%s\")\t%s\tNetflix Streaming\n",\
        URL,title,date)
    recordsPrinted += 1
    if (recordsPrinted >= maxRecordsToPrint)
        exit
}

error: pathspec 'generateLinksFrom-NetflixActivityPage.awk' did not match any file(s) known to git


Added rounding routind for awk

Added rounding routind for awk

# round.awk --- do normal rounding

function round(x,   ival, aval, fraction)
{
   ival = int(x)    # integer part, int() truncates

   # see if fractional part
   if (ival == x)   # no fraction
      return ival   # ensure no decimals

   if (x < 0) {
      aval = -x     # absolute value
      ival = int(aval)
      fraction = aval - ival
      if (fraction >= .5)
         return int(x) - 1   # -2.5 --> -3
      else
         return int(x)       # -2.3 --> -2
   } else {
      fraction = x - ival
      if (fraction >= .5)
         return ival + 1
      else
         return ival
   }
}

error: pathspec 'round.awk' did not match any file(s) known to git


New file.

New file.

# LINEBREAK.awk -- awk script to produce a compact linebreak property map
# Copyright (C) 2005
#   National Institute of Advanced Industrial Science and Technology (AIST)
#   Registration Number H15PRO112

# This file is part of the m17n database; a sub-part of the m17n
# library.

# The m17n library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.

# The m17n library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.

# You should have received a copy of the GNU Lesser General Public
# License along with the m17n library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307, USA.

function setLBC(name, code) {
  if (code % 10 == 0)
    printf "\n# %2d:%s", code, name;
  else
    printf "  %2d:%s", code, name;
  to_lbc[name] = code;
}

BEGIN {
  FS = "[; ]";
  from = "";
  to = "";
  prev_lbc = -1;
  i = 0;
  printf "# Code:LineBreakingClass";
  # Assign a uniq integer code to each line breaking class.
  # The codes must be the same as "enum LineBreakingClass" of
  # m17n-lib/src/linebreak.c
  setLBC("OP", i++);		# open
  setLBC("CL", i++);		# close
  setLBC("QU", i++);		# quotation
  setLBC("GL", i++);		# glue
  setLBC("NS", i++);		# no-start
  setLBC("EX", i++);		# exclamation/interrogation
  setLBC("SY", i++);		# Syntax (slash)
  setLBC("IS", i++);		# infix (numeric) separator
  setLBC("PR", i++);		# prefix
  setLBC("PO", i++);		# postfix
  setLBC("NU", i++);		# numeric
  setLBC("AL", i++);		# alphabetic
  setLBC("ID", i++);		# ideograph (atomic)
  setLBC("IN", i++);		# inseparable
  setLBC("HY", i++);		# hyphen
  setLBC("BA", i++);		# break after
  setLBC("BB", i++);		# break before
  setLBC("B2", i++);		# break both
  setLBC("ZW", i++);		# ZW space
  setLBC("CM", i++);		# combining mark
  setLBC("WJ", i++);		# word joiner

  # For UAX#14 7.6 Korean Syllable Block Pair Table.
  setLBC("H2", i++);		# Hamgul 2 Jamo Syllable
  setLBC("H3", i++);		# Hangul 3 Jamo Syllable
  setLBC("JL", i++);		# Jamo leading consonant
  setLBC("JV", i++);		# Jamo vowel
  setLBC("JT", i++);		# Jamo trailing consonant

  # Not handled in the pair table.
  setLBC("SA", i++);		# south (east) asian
  setLBC("SP", i++);		# space
  setLBC("PS", i++);		# paragraph and line separators
  setLBC("BK", i++);		# hard break (newline)
  setLBC("CR", i++);		# carriage return
  setLBC("LF", i++);		# line feed
  setLBC("NL", i++);		# next line
  setLBC("CB", i++);		# contingent break opportunity
  setLBC("SG", i++);		# surrogate
  setLBC("AI", i++);		# ambiguous
  setLBC("XX", i);		# unknown

  # The default is "XX".
  printf "\n0x0000-0x3FFFFF %d\n", i;
}

/^[0-9A-Za-z]*;/ {
  lbc = to_lbc[$2];
  if (prev_lbc != lbc)
    {
      if (prev_lbc != -1)
	{
	  if (from == to)
	    printf "%s %d\n", from, prev_lbc;
	  else
	    printf "%s-%s %d\n", from, to, prev_lbc;
	}
      from = "0x" $1;
      to = "0x" $1;
      prev_lbc = lbc;
    }
  else
    to = "0x" $1;
  next;
}

/^[0-9A-Za-z]*\.\.[0-9A-Za-z]*;/ {
  lbc = to_lbc[$2];
  if (prev_lbc != -1)
    {
      if (from == to)
	printf "%s %d\n", from, prev_lbc;
      else
	printf "%s-%s %d\n", from, to, prev_lbc;
    }
  gsub("\\.\\.", "-0x");
  printf "0x%s %d\n", $1, lbc;
  from = "";
  to = "";
  prev_lbc = -1;
  next;
}

END {
  if (prev_lbc != -1)
    {
      if (from == to)
	printf "0x%s %d\n", from, prev_lbc;
      else
	printf "0x%s-0x%s %d\n", from, to, prev_lbc;
    }
}

error: pathspec 'LINEBREAK.awk' did not match any file(s) known to git


Create webserver.awk

Create webserver.awk

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/lramage94/dotfiles.git/'


dc["sage-spy.awk <timeout>", "", "try 2.1 for FTP"]


Added script to check if a file is grouped.

It's in awk, don't hate me.

#!/usr/bin/gawk -f
$1 in edges && current != $1 {
  print "File is not grouped.";
  exit;
}

{
  current = $1;
  edges[$1] = 1;
}

error: pathspec 'check_grouped.awk' did not match any file(s) known to git


Moved from ../LANGUAGE.awk.  Modified to use native.ext.

# LANGUAGE.awk -- awk script to generate LANGUAGE.tbl	-*- coding: utf-8; -*-
# Copyright (C) 2007
#   National Institute of Advanced Industrial Science and Technology (AIST)
#   Registration Number H15PRO112

# This file is part of the m17n database; a sub-part of the m17n
# library.

# The m17n library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.

# The m17n library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.

# You should have received a copy of the GNU Lesser General Public
# License along with the m17n library; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.

BEGIN {
    print ";; LANGUAGE.tbl -- ISO639 Language Code		-*- mode:lisp; coding:utf-8; -*-";
    print ";; Copyright (C) 2007";
    print ";;   National Institute of Advanced Industrial Science and Technology (AIST)";
    print ";;   Registration Number H15PRO112";
    print "";
    print ";; This file is part of the m17n database; a sub-part of the m17n";
    print ";; library.";
    print "";
    print ";; The m17n library is free software; you can redistribute it and/or";
    print ";; modify it under the terms of the GNU Lesser General Public License";
    print ";; as published by the Free Software Foundation; either version 2.1 of";
    print ";; the License, or (at your option) any later version.";
    print "";
    print ";; The m17n library is distributed in the hope that it will be useful,";
    print ";; but WITHOUT ANY WARRANTY; without even the implied warranty of";
    print ";; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU";
    print ";; Lesser General Public License for more details.";
    print "";
    print ";; You should have received a copy of the GNU Lesser General Public";
    print ";; License along with the m17n library; if not, write to the Free";
    print ";; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,";
    print ";; Boston, MA 02110-1301, USA.";
    print ";;";
    print ";; The file format is this:";
    print ";;    (ISO639-2 ISO639-1 \"ENGLISH-NAME\" [ \"NATIVE-NAME\" [ \"EXTRA-CHARS\" ]]) ...";
    print ";; ISO639-2: 3-letter language code of ISO639-2.";
    print ";; ISO639-1: 2-letter language code of ISO639-1, or nil if it doesn't exist.";
    print ";; ENGLISH-NAME: English name of the language.";
    print ";; NATIVE-NAME: Native name of the language.";
    print ";; EXTRA-CHARS: Extra characters that uniquifies the language.";
    print ";;";
    print ";; ISO639-2 and ISO639-1 are extracted from ISO-639-2.txt.";
    print ";; ENGLISH-NAME and NATIVE-NAME are mainly extracted from CLDR,";
    print ";;   but are also supplemented from these sites:";

    while (getline < "native.txt") {
	if ($0 ~ /^[a-z]/) {
	    NATIVE[$1] = $2;
	    if ($3 != "")
		CHARS[$1] = $3;
	} else if ($0 ~ /^;;/) {
	    print;
	}
    }
    while (getline < "native.ext") {
	if ($0 ~ /^[a-z]/) {
	    NATIVE[$1] = $2;
	}
    }
    while (getline < "en.tbl") {
	split($0, array, "\(| \"|\" \"|\"\)")
	ENGLISH[array[2]] = array[3];
    }
}

/^[a-z][a-z][a-z]\|/ {
    code3 = $1;
    code2 = $3;
    if (code2 == "" || code2 == "NULL")
	code2 = "nil";
    native = NATIVE[code2];
    if (! native)
	native = NATIVE[code3];
    chars = CHARS[code3];
    name = $4;
    name = ENGLISH[code2];
    if (! name)
	name = ENGLISH[code3];
    if (name == "Greek, Modern (1453-)")
	name = "Greek";
    else {
	gsub("; .*", "", name);
	gsub(" \\(Other\\)$", "", name);
	gsub(" languages$", "", name);
	if (name ~ /\(.*[0-9].*\)$/)
	    gsub(" \\([^)]*\\)$", "", name);
	if (name ~ ", ") {
	    split(name, array, ", ");
	    name = array[2] " " array[1];
	}
    }
    printf "(%s %-3s \"%s\"", code3, code2, name;
    if (native != "")
	printf " \"%s\"", native;
    else if (chars != "")
	printf " nil";
    if (chars != "")
	printf " \"%s\"", chars;
    printf ")\n";
}

error: pathspec 'LANGDATA/LANGUAGE.awk' did not match any file(s) known to git


struggle with speedseq

struggle with speedseq

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/marcelm/CAW.git/'


Create zad4.awk

Create zad4.awk

#Z pliku /etc/passwd wypisać wszystkie wpisy o innych użytkownikach niż root, których UID jest równy 0, w przeciwnym przypadku wypisać test informujący, że takich użytkowników nie znaleziono.

BEGIN {FS=":"}
$1!="root" && $3=="0"{brak++;print $1}
END {if(brak==0) print"brak uzytkownikow"}

error: pathspec 'AWK/zad4.awk' did not match any file(s) known to git


fixed bug of missing header variable in file exist check

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/orbifx/yamado.git/'


added awk script

added awk script

#!/bin/awk -f
#
# buraq: this awk script was used to add a colon to .neg files in test suite.
#        though it might be useful to have it somewhere for non-awk users as a reference.
#
{ i = match ($0, /scala:[0-9]+/);
   if(i == 0) {
	 print $0
   } else {
	   sub(/scala:[0-9]+/, "&:")
		   print $0
   }
}

error: pathspec 'src/build/addcolon.awk' did not match any file(s) known to git


Create postbanken.awk

Create postbanken.awk

Um aus der CSV-Datei von der Poatbank für GNUCash eine QIF-Datei zu erzeugen, kann dieses AWK-Skript verwenden.
Ich habe dieses AWK-Skript auf der Webseite "http://wiki.gnucash.org/wiki/FAQ#Q:_How_do_I_convert_from_CSV.2C_TSV.2C_XLS_.28Excel.29.2C_or_SXC_.28OpenOffice.org_Calc.29_to_a_QIF.3F" gefunden.

#
# Quelle (2014-12-07):
# http://wiki.gnucash.org/wiki/FAQ#Q:_How_do_I_convert_from_CSV.2C_TSV.2C_XLS_.28Excel.29.2C_or_SXC_.28OpenOffice.org_Calc.29_to_a_QIF.3F
# Anwendung:
# awk -f postbanken.awk kontoutskrift.csv > import.qif
#
# awk convert fra Postbankens CSV til QIF(Gnucash, quicken, osv)
# CSV fra Postbanken er ikke en kommaseparert fil, men en tekstfil med feltene på fast plass.
# Bruker derfor fieldwidths i awk. Det går også ant å bruke substr().
# Kilder:
# http://wiki.gnucash.org/wiki/FAQ
# http://www.ibm.com/developerworks/library/l-awk1.html
# http://www.ibm.com/developerworks/library/l-awk2.html
# http://www.grymoire.com/Unix/Awk.html#uh-67
# Samt manualen til awk og egrep.
#
# Bruk filen slik:
# $ awk -f postbanken.awk kontoutskrift.csv > import.qif
#
#
# Arve Seljebu - juni 2010

# Del opp filen i felter og skriv "!Type:Bank" bare en gang i toppen av filen
BEGIN {FIELDWIDTHS="8 5 17 35 31 11 1 11"; print "!Type:Bank";}
# Bare bruk linjen hvis den inneholder dato
{ if ($0 ~ /[0-9][0-9].[0-9][0-9].[0-9][0-9]/) {
# Dato
  print "D" $1;
# Avkommenter neste linje for å bruke BETALING, BETALING UTLAND osv som konto/kategori
# print "L" $3;
# Beskrivelse/memo
  print "M" $4;
# Debit eller kredit
  if ($6 == 0) { print "T-" $8; }
  else { print "T" $6; }
  print "^";
  }
}

error: pathspec 'postbanken.awk' did not match any file(s) known to git


packager monitoring

packager monitoring

BEGIN{
    if(!maxInterval)
        maxInterval=60
    if(!maxChunkDuration)
        maxChunkDuration=12000
    if(!minChunkDuration)
        minChunkDuration=1000
    state = "waitChunk"
    if(!verbose)
        verbose=1
}

function addStats(caption,data){
    cnts[caption] = cnts[caption] + 1
    sums[caption] = sums[caption] + data
    sums2[caption] = sums2[caption] + data*data
}

function printStats(caption){
    cnt = cnts[caption]
    if(cnt){
        sum = sums[caption]
        sum2 = sums2[caption]
        stddev = 0
        if((cnt > 1)){
         stddev = sqrt( (sum2*cnt -sum*sum) / (cnt*(cnt-1)))
        }
        printf "%s avg request interval: %.2f stddev: %.2f #: %d\n", caption,sum/cnt,stddev,cnt
    } else {
        print "couldn't find stats for "caption
    }
}

$0 ~ /\[debug\]/ && $0 ~ /GET \/hls\/(.*)\/playlist.json\/seg/ {
    split($10,b,"-");
    lastChunkPath=$10
    if(verbose){
        print $2 " "lastChunkPath;
    }
    if(lastChunk && lastChunk+1 != b[2]){
        print $2" "lastChunkPath" error: expected chunk "lastChunk+1" got: "b[2]
        delete __lastDTS[0]
    }
    lastChunk=b[2];
    split($2,a,":");
    time=a[3]+a[2]*60+a[1]*3600;
    if(lastTime){
        diff=time-lastTime
        if(diff>maxInterval){
            print $2" "lastChunkPath" error: requested chunk after "diff" sec."
        }
        if(diff>0){
            addStats("chunkInterval",diff)
        }
    }
    lastTime = time
    state = "checkDTS"
}

verbose && state == "checkDTS" && $0 ~ /parsed clip source/ {
    print $2" "$11" "$12" "$13
}

state == "checkDTS" && $0 ~ /first frame dts/ {
    state = "waitChunk"
    if( __lastDTS[0]){
        chunkDuration = $11 -  __lastDTS[0]

        addStats("chunkDuration",chunkDuration)
        if(chunkDuration > maxChunkDuration || chunkDuration < minChunkDuration){
            print $2" "lastChunkPath" bad chunk duration "chunkDuration
        }
    }
     __lastDTS[0] = $11
}

END {
    printStats("chunkInterval")
    printStats("chunkDuration")
}

error: pathspec 'node_addons/FormatConverter/test/anal_nginx_log_packager.awk' did not match any file(s) known to git


2008-01-03  Martin Sebor  <sebor@roguewave.com>

	* bin/xcomp.awk (sectcomponents): Added an array of lists of component
	names for each section with each list maintaining the same order as
	in the logs.
	(print_section): Used the sectcomponents array to print components
	in each table in the same order as they appear in the build logs.

git-svn-id: 1e8a4076bc3774682289f662a06025447996ff23@608678 13f79535-47bb-0310-9956-ffa450edef68


ch = str_split(br[3], pa, ".")

ch = str_split(br[3], pa, ".")

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/svnpenn/sage.git/'