Create zad2.awk

Create zad2.awk

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

--- AWK/zad2.awk
+++ AWK/zad2.awk
@@ -0,0 +1,5 @@
+#Z pliku /etc/passwd wyliczyć sumę i średnią arytmetyczną wszystkich numerów UID.
+
+BEGIN{FS=":"; s=0;} #FS - separator pól
+{s=s+$3} #$3 jest naszym /etc/passwd
+END{srednia=s/NR; print "srednia:", srednia", suma", s;} #NR - liczba przeczytanych rekordów


dummy collapse branches based on support. Do not really collapse bu simply transform branches low supported branches to zero length.

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


Create f.awk

Create f.awk

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


double

double

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

--- src/awk/checkdouble.awk
+++ src/awk/checkdouble.awk
@@ -0,0 +1,24 @@
+#! /bin/awk -f
+
+#check back to back double occurrence of a word
+
+BEGIN {
+}
+
+#body
+FILENAME != prevfile {
+  NR = 1
+  prevfile = FILENAME
+}
+NF > 0{
+  if ($1 == lastword)
+     printf "double %s, file %s, line %d\n", $1, FILENAME, NR
+  for (i=2; i <= NF; i++)
+      if ($i == $(i-1))
+         printf "double %s, file %s, line %d\n", $i, FILENAME, NR
+  if (NF > 0){
+     lastword = $NF
+  }
+}
+END {
+}


add tool.ddet/align_element.awk

add tool.ddet/align_element.awk

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


Create thisisfreesoftware.awk

Create thisisfreesoftware.awk

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

--- thisisfreesoftware.awk
+++ thisisfreesoftware.awk
@@ -0,0 +1,2 @@
+#!/usr/bin/awk -f
+BEGIN {print "Fuck you Mendez."}


add tool.tde2d/calculateMass.awk

add tool.tde2d/calculateMass.awk

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


splitting PGN files

splitting PGN files

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

--- splitpgn.awk
+++ splitpgn.awk
@@ -0,0 +1,9 @@
+#!/usr/bin/awk
+
+BEGIN { i = 0 }
+
+/^\[Event/ { close(out)
+             i += 1
+             out = i ".pgn" }
+
+{ print $0 >out }


we need better templating...working on that

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

--- template.awk
+++ template.awk
@@ -0,0 +1,51 @@
+#! /usr/bin/awk -f
+#
+# Copyright © Adrian Perez <aperez@igalia.com>
+#
+# Converts an HTML template into a C header suitable for inclusion.
+# Take a look at the HACKING.rst file to know how to use it :-)
+#
+# This code is placed in the public domain.
+
+BEGIN {
+	varname = 0;
+	print "/* Automagically generated, do not edit! */"
+	vars_count = 0;
+}
+
+/^<!--[[:space:]]*var[[:space:]]+[^[:space:]]+[[:space:]]*-->$/ {
+	if (varname) print ";";
+	if ($3 == "NONE") {
+		varname = 0;
+		next;
+	}
+	varname = $3;
+	vars[vars_count++] = varname;
+	print "static const u_char " varname "[] = \"\"";
+	next;
+}
+
+/^$/ {
+	if (!varname) next;
+	print "\"\\n\"";
+	next;
+}
+
+{
+	if (!varname) next;
+	# Order matters
+	gsub(/[\t\v\n\r\f]+/, "");
+	gsub(/\\/, "\\\\");
+	gsub(/"/, "\\\"");
+	print "\"" $0 "\""
+}
+
+
+END {
+	if (varname) print ";";
+	print "#define NFI_TEMPLATE_SIZE (0 \\";
+	for (var in vars) {
+		print "\t+ nfi_sizeof_ssz(" vars[var] ") \\";
+	}
+	print "\t)"
+}


adds omfgene awk

adds omfgene awk

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

--- omfgene.awk
+++ omfgene.awk
@@ -0,0 +1,22 @@
+# Count discordant paired-end alignments & mates > 500k bases away
+
+# Absolute value
+function abs(v) {
+	return v < 0 ? -v : v
+}
+
+# Round to nearest 100
+function rnd(v) {
+	r = v / 100
+	i = int(r)
+	d = r - i
+	return d >= 0.5 ? (i + 1) * 100 : i * 100
+}
+
+# Parse SAM
+# If primary alignment AND mate mapped AND (mate is on different chr OR mate is more than 500k away)
+# print alignments rounded to nearest 100
+# Format: mate 1 chrom TAB mate 1 rounded coordinate TAB mate 2 chrom TAB mate 2 rounded coordinate TAB 1 if secondary else 0
+$7 != "*" && ($7 != "=" && $7 != $3 || (abs($4-$8) > 500000)) {
+	print $3 "\t" rnd($4) "\t" ($7 == "=" ? $3 : $7) "\t" rnd($8) "\t" (int($2 / 256) % 2)
+}


add tool.hgas/split_particle.awk

add tool.hgas/split_particle.awk

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


Add AWK script to compute the mid-range

Add AWK script to compute the mid-range

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

--- tools/awk/midrange.awk
+++ tools/awk/midrange.awk
@@ -0,0 +1,27 @@
+#!/usr/bin/env awk -f
+#
+# Computes the mid-range.
+#
+# Usage: mid-range
+#
+# Input:
+#   - a column of numbers
+#
+# Output:
+#   - mid-range
+
+!i++ {
+	# Only for the first record:
+	max = $1
+	min = $1
+}
+{
+	if ($1 > max) {
+		max = $1
+	} else if ($1 < min) {
+		min = $1
+	}
+}
+END {
+	print (max + min) / 2
+}


Added Tower of Hanoi in AWK

Added Tower of Hanoi in AWK

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

--- Towers_Of_Hanoi/AWK/wasi0013/Hanoi.awk
+++ Towers_Of_Hanoi/AWK/wasi0013/Hanoi.awk
@@ -0,0 +1,18 @@
+//Towers of Hanoi problem algorithm implementation
+//See: http://en.wikipedia.org/wiki/Tower_of_Hanoi
+
+func move(n,src,dest,temp){
+ 	if(n>=1){
+    move(n-1,src,temp,dest);
+    printf("Move %d -> %d\n",src,dest);
+    move(n-1,temp,dest,src);
+	}
+}
+
+BEGIN {
+	print"Test run with values: 3,1,3,2";
+	move(3,1,3,2);
+}
+END {
+	print"The test was successful";
+}


Added json.awk

Added json.awk

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

--- utils/json.awk
+++ utils/json.awk
@@ -0,0 +1,246 @@
+#!/bin/awk -f
+#
+# Software: JSON.awk - a practical JSON parser written in awk
+# Version: 1.10
+# Author: step- on github.com
+# License: This software is licensed under the MIT or the Apache 2 license.
+# Project home: https://github.com/step-/JSON.awk.git
+# Credits: This software includes major portions of JSON.sh, a pipeable JSON
+#   parser written in Bash, retrieved on 20130313
+#   https://github.com/dominictarr/JSON.sh
+#
+
+BEGIN { #{{{
+  # option_BRIEF(1) - parse() omits printing non-leaf nodes
+  BRIEF=1;
+  # option_STREAM(0) - parse() omits stdout and stores jpaths in JPATHS[]
+  STREAM=1;
+  # for each input file:
+  #   TOKENS[], NTOKENS, ITOKENS - tokens after tokenize()
+  #   JPATHS[], NJPATHS - parsed data (when STREAM=0)
+  # at script exit:
+  #   FAILS[] - maps names of invalid files to logged error lines
+  delete FAILS
+
+  # filepathnames from stdin
+  # usage: echo -e "file1\nfile2\n" | awk -f JSON.awk
+  # usage: { echo -; echo; cat; } | awk -f JSON.awk
+  while (getline ARGV[++ARGC] < "/dev/stdin") {
+    if (ARGV[ARGC] == "")
+      break
+  }
+  # set file slurping mode
+  srand(); RS="n/o/m/a/t/c/h" rand()
+}
+#}}}
+
+{ # main loop: process each file in turn {{{
+  reset() # See important application note in reset()
+
+  tokenize($0) # while(get_token()) {print TOKEN}
+  if (0 == parse()) {
+    apply(JPATHS, NJPATHS)
+  }
+}
+#}}}
+
+END { # process invalid files {{{
+  for(name in FAILS) {
+    print "invalid: " name
+    print FAILS[name]
+  }
+}
+#}}}
+
+function apply (ary, size,   i) { # stub {{{
+  for (i=1; i<size; i++)
+    print ary[i]
+}
+#}}}
+
+function get_token() { #{{{
+# usage: {tokenize($0); while(get_token()) {print TOKEN}}
+
+  # return getline TOKEN # for external tokenizer
+
+  TOKEN = TOKENS[++ITOKENS] # for internal tokenize()
+  return ITOKENS < NTOKENS
+}
+#}}}
+
+function parse_array(a1,   idx,ary,ret) { #{{{
+  idx=0
+  ary=""
+  get_token()
+#scream("parse_array(" a1 ") TOKEN=" TOKEN)
+  if (TOKEN != "]") {
+    while (1) {
+      if (ret = parse_value(a1, idx)) {
+        return ret
+      }
+      idx=idx+1
+      ary=ary VALUE
+      get_token()
+      if (TOKEN == "]") {
+        break
+      } else if (TOKEN == ",") {
+        ary = ary ","
+      } else {
+        report(", or ]", TOKEN ? TOKEN : "EOF")
+        return 2
+      }
+      get_token()
+    }
+  }
+  if (1 != BRIEF) {
+    VALUE=sprintf("[%s]", ary)
+  } else {
+    VALUE=""
+  }
+  return 0
+}
+#}}}
+
+function parse_object(a1,   key,obj) { #{{{
+  obj=""
+  get_token()
+#scream("parse_object(" a1 ") TOKEN=" TOKEN)
+  if (TOKEN != "}") {
+    while (1) {
+      if (TOKEN ~ /^".*"$/) {
+        key=TOKEN
+      } else {
+        report("string", TOKEN ? TOKEN : "EOF")
+        return 3
+      }
+      get_token()
+      if (TOKEN != ":") {
+        report(":", TOKEN ? TOKEN : "EOF")
+        return 4
+      }
+      get_token()
+      if (parse_value(a1, key)) {
+        return 5
+      }
+      obj=obj key ":" VALUE
+      get_token()
+      if (TOKEN == "}") {
+        break
+      } else if (TOKEN == ",") {
+        obj=obj ","
+      } else {
+        report(", or }", TOKEN ? TOKEN : "EOF")
+        return 6
+      }
+      get_token()
+    }
+  }
+  if (1 != BRIEF) {
+    VALUE=sprintf("{%s}", obj)
+  } else {
+    VALUE=""
+  }
+  return 0
+}
+#}}}
+
+function parse_value(a1, a2,   jpath,ret,x) { #{{{
+  jpath=(a1!="" ? a1 "," : "") a2 # "${1:+$1,}$2"
+#scream("parse_value(" a1 "," a2 ") TOKEN=" TOKEN ", jpath=" jpath)
+  if (TOKEN == "{") {
+    if (parse_object(jpath)) {
+      return 7
+    }
+  } else if (TOKEN == "[") {
+    if (ret = parse_array(jpath)) {
+      return ret
+  }
+  } else if (TOKEN ~ /^(|[^0-9])$/) {
+    # At this point, the only valid single-character tokens are digits.
+    report("value", TOKEN!="" ? TOKEN : "EOF")
+    return 9
+  } else {
+    VALUE=TOKEN
+  }
+  if (! (1 == BRIEF && ("" == jpath || "" == VALUE))) {
+    x=sprintf("[%s]\t%s", jpath, VALUE)
+    if(0 == STREAM) {
+      JPATHS[++NJPATHS] = x
+    } else {
+      print x
+    }
+  }
+  return 0
+}
+#}}}
+
+function parse(   ret) { #{{{
+  get_token()
+  if (ret = parse_value()) {
+    return ret
+  }
+  if (get_token()) {
+    report("EOF", TOKEN)
+    return 11
+  }
+  return 0
+}
+#}}}
+
+function report(expected, got,   i,from,to,context) { #{{{
+  from = ITOKENS - 10; if (from < 1) from = 1
+  to = ITOKENS + 10; if (to > NTOKENS) to = NTOKENS
+  for (i = from; i < ITOKENS; i++)
+    context = context sprintf("%s ", TOKENS[i])
+  context = context "<<" got ">> "
+  for (i = ITOKENS + 1; i <= to; i++)
+    context = context sprintf("%s ", TOKENS[i])
+  scream("expected <" expected "> but got <" got "> at input token " ITOKENS "\n" context)
+}
+#}}}
+
+function reset() { #{{{
+# Application Note:
+# If you need to build JPATHS[] incrementally from multiple input files:
+# 1) Comment out below:        delete JPATHS; NJPATHS=0
+#    otherwise each new input file would reset JPATHS[].
+# 2) Move the call to apply() from the main loop to the END statement.
+# 3) In the main loop consider adding code that deletes partial JPATHS[]
+#    elements that would result from parsing invalid JSON files.
+
+  TOKEN=""; delete TOKENS; NTOKENS=ITOKENS=0
+  delete JPATHS; NJPATHS=0
+  VALUE=""
+}
+#}}}
+
+function scream(msg) { #{{{
+  FAILS[FILENAME] = FAILS[FILENAME] (FAILS[FILENAME]!="" ? "\n" : "") msg
+  msg = FILENAME ": " msg
+  print msg >"/dev/stderr"
+}
+#}}}
+
+function tokenize(a1,   pq,pb,ESCAPE,CHAR,STRING,NUMBER,KEYWORD,SPACE) { #{{{
+# usage A: {for(i=1; i<=tokenize($0); i++) print TOKENS[i]}
+# see also get_token()
+
+  # POSIX character classes (gawk) - contact me for non-[:class:] notation
+  # Replaced regex constant for string constant, see https://github.com/step-/JSON.awk/issues/1
+#  ESCAPE="(\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})"
+#  CHAR="[^[:cntrl:]\\\"]"
+#  STRING="\"" CHAR "*(" ESCAPE CHAR "*)*\""
+#  NUMBER="-?(0|[1-9][0-9]*)([.][0-9]*)?([eE][+-]?[0-9]*)?"
+#  KEYWORD="null|false|true"
+  SPACE="[[:space:]]+"
+
+#        gsub(STRING "|" NUMBER "|" KEYWORD "|" SPACE "|.", "\n&", a1)
+  gsub(/\"[^[:cntrl:]\"\\]*((\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})[^[:cntrl:]\"\\]*)*\"|-?(0|[1-9][0-9]*)([.][0-9]*)?([eE][+-]?[0-9]*)?|null|false|true|[[:space:]]+|./, "\n&", a1)
+        gsub("\n" SPACE, "\n", a1)
+  sub(/^\n/, "", a1)
+  ITOKENS=0 # get_token() helper
+  return NTOKENS = split(a1, TOKENS, /\n/)
+}
+#}}}
+
+# vim:fdm=marker:


Add AWK script to sample a column of values

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

--- tools/awk/sample.awk
+++ tools/awk/sample.awk
@@ -0,0 +1,37 @@
+#!/usr/bin/env awk -f
+#
+# Samples a column of values.
+#
+# Usage: sample prob seed
+#
+# Input:
+#   - a column of values
+#
+# Arguments:
+#   - prob: success probability
+#   - seed: pseudorandom number generator seed
+#
+# Output:
+#   - sample values
+#
+# Example:
+#   $ sample 0.1 $RANDOM
+
+BEGIN {
+	if (ARGC == 1) {
+		prob = 0.5
+	} else if (ARGC == 2) {
+		prob = ARGV[1]
+		ARGV[1] = ""
+	} else {
+		prob = ARGV[1]
+		srand(ARGV[2])
+		ARGV[1] = ""
+		ARGV[2] = ""
+	}
+	# No filenames so force stdin:
+	ARGV[ARGC++] = "-"
+}
+rand() <= prob {
+	print $0
+}


k_puts(dc)

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 script for reporting clockss progress

git-svn-id: 293778eaa97c8c94097d610b1bd5133a8f478f36@15673 4f837ed2-42f5-46e7-a7a5-fa17313484d4

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

--- scripts/tdb/statuses_clockss.awk
+++ scripts/tdb/statuses_clockss.awk
@@ -0,0 +1,46 @@
+#!/usr/bin/awk -f
+# input: publisher\tcontract_year\tyear\tstatus
+
+BEGIN {
+  FS="\t"
+  pn = 0
+}
+
+{
+  if (!(($1,$2,$3) in b)) {
+    p[pn] = $1
+    t[pn] = $2
+    d[pn] = $3
+    pn++
+  }
+  b[$1,$2,$3]++
+  c[$1,$2,$3,$4]++
+}
+
+END {
+  s[0] = "expected"
+  s[1] = "exists"
+  s[2] = "manifest"
+  s[3] = "wanted"
+  s[4] = "crawling"
+  s[5] = "testing"
+  s[6] = "notReady"
+  s[7] = "released"
+  s[8] = "down"
+  s[9] = "superseded"
+  sn = 10
+
+  printf "Publisher\tContract\tYear\tTotal"
+  for (j = 0 ; j < sn ; j++) {
+    printf "\t%s", s[j]
+  }
+  printf "\n"
+
+  for (i = 0 ; i < pn ; i++) {
+    printf "%s\t%s\t%s\t%d", p[i], t[i], d[i], b[p[i],t[i],d[i]]
+    for (j = 0 ; j < sn ; j++) {
+      printf "\t%d", c[p[i],t[i],d[i],s[j]]
+    }
+    printf "\n"
+  }
+}


shortened 03/awk/main2.awk

shortened 03/awk/main2.awk


created

created

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

--- Win32/binary/genplotscript.awk
+++ Win32/binary/genplotscript.awk
@@ -0,0 +1,29 @@
+#!/usr/bin/awk -f
+/\#t/
+{
+  printf("set data style linespoints\n");
+  printf("plot");
+  n = 0;
+  for (i = 2; i != ARGC; i++)
+  {
+    for (j = 2; j != NF+1; j++)
+    {
+      if (ARGV[i] == $(j))
+      {
+        printf(" '");
+	printf(ARGV[1]);
+	printf("'");
+	printf(" using 1:");
+	printf(j);
+	printf(" title '");
+	printf($(j));
+	printf("'");
+
+	if (i != ARGC - 1)
+	   printf(",");
+	n++;
+      }
+    }
+  }
+  exit 0;
+}


Add a short program that rewrites the testdata/rsyncd.log timestamps to nowish.

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

--- log_rewriter.awk
+++ log_rewriter.awk
@@ -0,0 +1,16 @@
+BEGIN{
+        now = systime()
+        format = "%Y/%m/%d %H:%M:%S"
+
+}
+{
+        split($1, DATE, "/")
+        split($2, TIME, ":")
+        $1 = ""
+        $2 = ""
+        t = mktime(DATE[1] " " DATE[2] " " DATE[3] " " TIME[1] " " TIME[2] " " TIME[3])
+        if (delta == "") {
+                delta = now - t
+        }
+        print strftime(format, t + delta) $0
+}


tiered build: ensure unused modules are removed from custom config as well as default

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/ozone-development/depricated-ozp-center.git/'


Add an awk script for reading CVC's output.

Fragile. But never mind.

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


adding awk, really

adding awk, really

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

--- def-desc.awk
+++ def-desc.awk
@@ -0,0 +1,35 @@
+
+BEGIN {
+    FS = "::";
+    VALUE = 0;
+    WORD = ""
+    DEF = "";
+}
+{
+    if (NF <=1 && VALUE == 1) {
+        if(WORD == "Description") {
+            printf("%s",DEF);
+            exit 0;
+        }
+        VALUE = 0;
+    } else if (NF == 2) {
+        # If new definition
+        if ($1 != "") {
+            # Clean up old definition
+            if (VALUE == 1) {
+                if (WORD == "Description") {
+                    printf("%s",DEF);
+                    exit 0;
+                }
+                VALUE = 0;
+            }
+            # New Definition
+            WORD = $1;
+            DEF = $2;
+        } else if(VALUE == 1) {
+            DEF=DEF $2;
+        }
+        VALUE = 1;
+    }
+}
+END{}


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/'


New file.

New file.

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

--- tbl2mim.awk
+++ tbl2mim.awk
@@ -0,0 +1,50 @@
+#!/usr/bin/gawk
+# Copyright (C) 2006
+#   National Institute of Advanced Industrial Science and Technology (AIST)
+#   Registration Number H15PRO112
+
+# This file is part of the m17n contrib; 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.
+
+BEGIN {
+    begin_table = 0;
+}
+
+/^ICON *=/ { ICON = " \""$3"\""; next; }
+/^NAME *=/ { NAME = tolower($3); next; }
+/^LANGUAGES *=/ { LANG = $3; next; }
+/^STATUS_PROMPT *=/ { TITLE = $3; next; }
+/^BEGIN_TABLE/ {
+    printf "(input-method %s %s)\n", LANG, NAME;
+    printf "(title \"%s\"%s)\n", TITLE, ICON;
+    printf "(map\n (trans";
+    begin_table = 1;
+    next;
+}
+/^END_TABLE/ {
+    begin_table = 0;
+    printf "))\n(state (init (trans)))\n";
+    next;
+}
+
+{
+    if (begin_table) {
+	gsub("[\\\\\"]", "\\\\&");
+	printf "\n  (\"%s\" \"%s\")", $1, $2;
+    }
+}


CVS_SILENT: updated awk syntax test

CVS_SILENT: updated awk syntax test

svn path=/trunk/kdelibs/kate/; revision=349251

--- part/tests/highlight.awk
+++ part/tests/highlight.awk
@@ -1,3 +1,4 @@
+#!/usr
 # AWK hl test

 # BEGIN and END are also matched as patterns
@@ -17,7 +18,10 @@

 }

+# TODO and FIXME also work in comments in Awk.

+# Also backslash in patterns works.
+/\/usr\/bin\/awk/ { print "This is me"; }

 END {
 	print p;


Mega map stats script

Mega map stats script

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

--- UGER/scripts/makemega_addstats.awk
+++ UGER/scripts/makemega_addstats.awk
@@ -0,0 +1,40 @@
+$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);
+}


Выводим расстояния

Выводим расстояния

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/sergey-raevskiy/ai.git/'


print ah_join(dc, RS)

print ah_join(dc, RS)


old com_err compat

old com_err compat

git-svn-id: 193148810cf65385f3a195dbc9a8b504846da3a2@4137 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/'


Init: scripts directory (e.g. rename files for easier sortability)

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


add PLTokenizer (initial)

add PLTokenizer (initial)

--- lib/PLTokenizer.awk
+++ lib/PLTokenizer.awk
@@ -0,0 +1,233 @@
+#!/usr/bin/gawk -f
+
+# Return an element if it belongs to the array;
+# Otherwise, return a null string.
+function belongsTo(element, array,
+                   ####
+                   i) {
+    for (i in array)
+        if (element == array[i]) return element
+    return ""
+}
+
+# Return one of the substrings if the string starts with it;
+# Otherwise, return a null string.
+function startsWithAny(string, substrings,
+                       ####
+                       i) {
+    for (i in substrings)
+        if (index(string, substrings[i]) == 1) return substrings[i]
+    return ""
+}
+
+# Return one of the patterns if the string matches this pattern at the beginning;
+# Otherwise, return a null string.
+function matchesAny(string, patterns,
+                    ####
+                    i) {
+    for (i in patterns)
+        if (string ~ "^" patterns[i]) return patterns[i]
+    return ""
+}
+
+# Tokenize a string.
+function plTokenize(returnTokens, string,
+                    delimiters,
+                    newlines,
+                    quotes,
+                    escapeChars,
+                    leftBlockComments,
+                    rightBlockComments,
+                    lineComments,
+                    reservedOperators,
+                    reservedPatterns,
+                    ####
+                    blockCommenting,
+                    c,
+                    currentToken,
+                    escaping,
+                    i,
+                    lineCommenting,
+                    p,
+                    quoting,
+                    r,
+                    s,
+                    tempGroup,
+                    tempPattern,
+                    tempString) {
+    # Default parameters
+    if (!delimiters[0]) {
+        delimiters[0] = " "  # whitespace
+        delimiters[1] = "\t" # horizontal tab
+        delimiters[2] = "\v" # vertical tab
+    }
+    if (!newlines[0]) {
+        newlines[0] = "\n" # line feed
+        newlines[1] = "\r" # carriage return
+    }
+    if (!quotes[0]) {
+        quotes[0] = "\"" # double quote
+    }
+    if (!escapeChars[0]) {
+        escapeChars[0] = "\\" # backslash
+    }
+    if (!leftBlockComments[0]) {
+        leftBlockComments[0] = "#|" # Lisp-style extended comment (open)
+        leftBlockComments[1] = "/*" # C-style comment (open)
+        leftBlockComments[2] = "(*" # ML-style comment (open)
+    }
+    if (!rightBlockComments[0]) {
+        rightBlockComments[0] = "|#" # Lisp-style extended comment (close)
+        rightBlockComments[1] = "*/" # C-style comment (close)
+        rightBlockComments[2] = "*)" # ML-style comment (close)
+    }
+    if (!lineComments[0]) {
+        lineComments[0] = ";"  # Lisp-style line comment
+        lineComments[1] = "//" # C++-style line comment
+        lineComments[2] = "#"  # hash comment
+    }
+    if (!reservedOperators[0]) {
+        reservedOperators[0] = "(" #  left parenthesis
+        reservedOperators[1] = ")" # right parenthesis
+        reservedOperators[2] = "[" #  left bracket
+        reservedOperators[3] = "]" # right bracket
+        reservedOperators[4] = "{" #  left brace
+        reservedOperators[5] = "}" # right brace
+        reservedOperators[6] = "," # comma
+    }
+    if (!reservedPatterns[0]) {
+        reservedPatterns[0] = "[+-]?((0|[1-9][0-9]*)|[.][0-9]*|(0|[1-9][0-9]*)[.][0-9]*)([Ee][+-]?[0-9]+)?" # numeric literal (scientific notation possible)
+        reservedPatterns[1] = "[+-]?0[0-7]+([.][0-7]*)?" # numeric literal (octal)
+        reservedPatterns[2] = "[+-]?0[Xx][0-9A-Fa-f]+([.][0-9A-Fa-f]*)?" # numeric literal (hexadecimal)
+    }
+
+    split(string, s, "")
+    currentToken = ""
+    quoting = escaping = blockCommenting = lineCommenting = 0
+    p = 0
+    i = 1
+    while (i <= length(s)) {
+        c = s[i]
+        r = substr(string, i)
+
+        if (blockCommenting) {
+            if (tempString = startsWithAny(r, rightBlockComments))
+                blockCommenting = 0 # block comment ends
+
+            i++
+
+        } else if (lineCommenting) {
+            if (belongsTo(c, newlines))
+                lineCommenting = 0 # line comment ends
+
+            i++
+
+        } else if (quoting) {
+            currentToken = currentToken c
+
+            if (escaping) {
+                escaping = 0 # escape ends
+
+            } else {
+                if (belongsTo(c, quotes)) {
+                    # Finish the current token
+                    if (currentToken) {
+                        returnTokens[p++] = currentToken
+                        currentToken = ""
+                    }
+
+                    quoting = 0 # quotation ends
+
+                } else if (belongsTo(c, escapeChars)) {
+                    escaping = 1 # escape begins
+
+                } else {
+                    # Continue
+                }
+            }
+
+            i++
+
+        } else {
+            if (belongsTo(c, delimiters) || belongsTo(c, newlines)) {
+                # Finish the current token
+                if (currentToken) {
+                    returnTokens[p++] = currentToken
+                    currentToken = ""
+                }
+
+                i++
+
+            } else if (belongsTo(c, quotes)) {
+                # Finish the current token
+                if (currentToken) {
+                    returnTokens[p++] = currentToken
+                }
+
+                currentToken = c
+
+                quoting = 1 # quotation begins
+
+                i++
+
+            } else if (tempString = startsWithAny(r, leftBlockComments)) {
+                # Finish the current token
+                if (currentToken) {
+                    returnTokens[p++] = currentToken
+                    currentToken = ""
+                }
+
+                blockCommenting = 1 # block comment begins
+
+                i += length(tempString)
+
+            } else if (tempString = startsWithAny(r, lineComments)) {
+                # Finish the current token
+                if (currentToken) {
+                    returnTokens[p++] = currentToken
+                    currentToken = ""
+                }
+
+                lineCommenting = 1 # line comment begins
+
+                i += length(tempString)
+
+            } else if (tempString = startsWithAny(r, reservedOperators)) {
+                # Finish the current token
+                if (currentToken) {
+                    returnTokens[p++] = currentToken
+                    currentToken = ""
+                }
+
+                # Reserve token
+                returnTokens[p++] = tempString
+
+                i += length(tempString)
+
+            } else if (tempPattern = matchesAny(r, reservedPatterns)) {
+                # Finish the current token
+                if (currentToken) {
+                    returnTokens[p++] = currentToken
+                    currentToken = ""
+                }
+
+                # Reserve token
+                match(r, "^" tempPattern, tempGroup)
+                returnTokens[p++] = tempGroup[0]
+
+                i += length(tempGroup[0])
+
+            } else {
+                # Continue with the current token
+                currentToken = currentToken c
+
+                i++
+            }
+        }
+    }
+
+    # Finish the last token
+    if (currentToken)
+        returnTokens[p++] = currentToken
+
+}


s_split(url, br, "/")

s_split(url, br, "/")


Add for updating the config file

Add for updating the config file

git-svn-id: 244fd0a71b5b35931765a3ae1f99e3319f3fb8ab@822470 13f79535-47bb-0310-9956-ffa450edef68

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

--- build/addloadexample.awk
+++ build/addloadexample.awk
@@ -0,0 +1,46 @@
+# Invoke as awk addloadexample.awk
+
+BEGIN {
+  lms = 0;
+}
+
+tolower($0) ~ /^[# \t]*loadmodule[ \t]/ {
+  if ( $2 == MODULE "_module" ) {
+    print "LoadModule " MODULE "_module " LIBPATH "/mod_" MODULE DSO;
+    lms = 2;
+    next;
+  }
+  # test $3 since # LoadModule is split into two tokens
+  else if ( $3 == MODULE "_module" ) {
+    print $1 "LoadModule " MODULE "_module " LIBPATH "/mod_" MODULE DSO;
+    lms = 2;
+    next;
+  }
+  else if ( ! lms ) lms = 1;
+}
+
+$0 ~ /^[ \t]*$/ && lms == 1 {
+  print "LoadModule " MODULE "_module " LIBPATH "/mod_" MODULE DSO;
+  lms = 2;
+}
+
+tolower($0) ~ /^[# \t]*include[ \t]/ && $NF == EXAMPLECONF {
+  lms = 3;
+}
+
+{ print }
+
+END {
+  if ( lms < 3 ) {
+    if ( ! /^[ \t]*$/ ) print "";
+    if ( lms < 2 ) {
+      print "LoadModule " MODULE "_module " LIBPATH "/mod_" MODULE DSO;
+      print "";
+    }
+    if ( length(EXAMPLECONF) ) {
+      print "# Example mod_" MODULE " configuration";
+      print "#Include " EXAMPLECONF "\n";
+    }
+  }
+}
+


Added more files for NDB Cluster

Added more files for NDB Cluster

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

--- ndb/home/bin/parseConfigFile.awk
+++ ndb/home/bin/parseConfigFile.awk
@@ -0,0 +1,98 @@
+BEGIN{
+    where=0;
+    n_hosts=0;
+    n_api=0;
+    n_ndb=0;
+    n_mgm=0;
+    n_ports=0;
+}
+/COMPUTERS/ {
+    where=1;
+}
+/\[[ \t]*COMPUTER[ \t]*\]/ {
+    where=1;
+}
+/PROCESSES/ {
+    where=2;
+}
+/Type: MGMT/ {
+    if(where!=1){
+	where=2;
+	n_mgm++;
+    }
+}
+/\[[ \t]*MGM[ \t]*\]/ {
+    where=2;
+    n_mgm++;
+}
+/Type: DB/ {
+    if(where!=1){
+	where=3;
+	n_ndb++;
+    }
+}
+/\[[ \t]*DB[ \t]*\]/ {
+    where=3;
+    n_ndb++;
+}
+/Type: API/ {
+    if(where!=1){
+	where=4;
+	n_api++;
+    }
+}
+/\[[ \t]*API[ \t]*\]/ {
+    where=4;
+    n_api++;
+}
+/HostName:/ {
+    host_names[host_ids[n_hosts]]=$2;
+}
+
+/FileSystemPath:/ {
+  if (where==3){
+    ndb_fs[ndb_ids[n_ndb]]=$2;
+  }
+}
+
+/Id:/{
+    if(where==1){
+	n_hosts++;
+	host_ids[n_hosts]=$2;
+    }
+    if(where==2){
+	mgm_ids[n_mgm]=$2;
+    }
+    if(where==3){
+	ndb_ids[n_ndb]=$2;
+    }
+    if(where==4){
+	api_ids[n_api]=$2;
+    }
+}
+/ExecuteOnComputer:/{
+    if(where==2){
+	mgm_hosts[mgm_ids[n_mgm]]=host_names[$2];
+    }
+    if(where==3){
+	ndb_hosts[ndb_ids[n_ndb]]=host_names[$2];
+    }
+    if(where==4){
+	api_hosts[api_ids[n_api]]=host_names[$2];
+    }
+}
+END {
+    for(i=1; i<=n_mgm; i++){
+	printf("mgm_%d=%s\n", mgm_ids[i], mgm_hosts[mgm_ids[i]]);
+    }
+    for(i=1; i<=n_ndb; i++){
+	printf("ndb_%d=%s\n", ndb_ids[i], ndb_hosts[ndb_ids[i]]);
+	printf("ndbfs_%d=%s\n", ndb_ids[i], ndb_fs[ndb_ids[i]]);
+    }
+    for(i=1; i<=n_api; i++){
+	printf("api_%d=%s\n", api_ids[i], api_hosts[api_ids[i]]);
+    }
+    printf("mgm_nodes=%d\n", n_mgm);
+    printf("ndb_nodes=%d\n", n_ndb);
+    printf("api_nodes=%d\n", n_api);
+}


tests: add example awk file  Changes to be committed: 	new file:   tests/syntax-highlighting/file.awk

error: pathspec 'tests/syntax-highlighting/file.awk' did not match any file(s) known to git

--- tests/syntax-highlighting/file.awk
+++ tests/syntax-highlighting/file.awk
@@ -0,0 +1,21 @@
+#!/usr/bin/awk -f
+# This is a comment line.
+
+# Special patterns:
+BEGIN
+END
+
+# Field variables:
+xxx$0xxx
+xx$NFxxx
+
+# String and numeric contansts:
+string = "Hello, World!"
+number = 42
+
+# Patterns:
+/\.'regexpr#"/ { print $0 }
+NR == 1, NR == 5 { printf("%s\n", $0) }
+
+# Statements:
+print string, number


cleaner comment

cleaner comment

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/szilvajuhos/CAW.git/'


add Jon's atmosphere converter

add Jon's atmosphere converter

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


contrib/slurm: add awk script to extract crash reports

Add awk script to extract crash reports from Scalaris log files. Simple grep
does not work because crash reports can expand over mutliple lines.

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

--- contrib/slurm/util/crashreport.awk
+++ contrib/slurm/util/crashreport.awk
@@ -0,0 +1,13 @@
+# Get all crashreports including reports spreading multiple lines
+
+BEGIN {
+    crashreport=0
+    timestamp_pattern="^20[[:digit:]]{2}-[[:digit:]]{2}-[[:digit:]]{2}"
+}
+
+# FILENAME == last_filename { last_filename=FILENAME}
+# FILENAME != last_filename { last_filename=FILENAME; print FILENAME}
+
+crashreport == 1 && $0 ~ timestamp_pattern { crashreport = 0; print ""} # leave crash report
+crashreport == 0 && /FD/ { crashreport = 1; print $0 } # enter crash report
+crashreport == 1 && $0 !~ timestamp_pattern { print "\t", $0 } # during crash report


Add linked-sensegram.awk

Add linked-sensegram.awk

error: pathspec 'misc/linked-sensegram.awk' did not match any file(s) known to git


LanguageHelper: scriptName(): add Mong

LanguageHelper: scriptName(): add Mong

--- include/LanguageHelper.awk
+++ include/LanguageHelper.awk
@@ -147,8 +147,9 @@
     case "Kore": return "Korean (Hangul + Han)"
     case "Laoo": return "Lao"
     case "Latn": return "Latin"
+    case "Mlym": return "Malayalam"
+    case "Mong": return "Mongolian"
     case "Mtei": return "Meitei Mayek"
-    case "Mlym": return "Malayalam"
     case "Mymr": return "Myanmar"
     case "Orya": return "Oriya"
     case "Sinh": return "Sinhala"


Parse Condor StarterLog

Parse Condor StarterLog

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

--- creation/web_base/parse_starterlog.awk
+++ creation/web_base/parse_starterlog.awk
@@ -0,0 +1,130 @@
+BEGIN {
+  year=strftime("%Y");
+  ended_jobs=0;
+  total_used=0;
+  goodputZ=0;
+  goodputNZ=0;
+  badputSignal=0;
+  badputOther=0;
+  goodjobsZ=0;
+  goodjobsNZ=0;
+  badjobsSignal=0;
+  badjobsOther=0;
+}
+
+# year is a 4 digit string or number
+# date is month/day
+# time is hour:minute:seconds
+function convert_date(year,date,time) {
+  split(date,datearr,"/");
+  split(time,timearr,":");
+  timestr=sprintf("%04d %02d %02d %02d %02d %02d",year,datearr[1],datearr[2],timearr[1],timearr[2],timearr[3]);
+  return mktime(timestr)
+}
+
+function percent(a,b) {
+  if (b==0) {
+    return 0;
+  } else {
+    return a*100/b;
+  }
+}
+
+########################################################################
+/ Communicating with shadow /{
+  # 7/17 10:42:20 (pid:26855) Communicating with shadow <131.225.204.208:34839>
+  #
+  for (i=1; i<NF; i++) {
+    if ($i=="Communicating") {
+      changenr=i;
+      break;
+    }
+  }
+  shadow=$(changenr+3);
+  shadow=substr(shadow,3,length(shadow)-4)
+  #print  $1,$2,"Shadow:",shadow
+}
+/ Starting .* job with ID /{
+  # 7/17 10:42:21 (pid:26855) Starting a VANILLA universe job with ID: 40.0
+  #
+  for (i=1; i<NF; i++) {
+    if ($i=="ID:") {
+      changenr=i;
+      break;
+    }
+  }
+  jid=$(changenr+1);
+  #print  $1,$2,"Jid:",jid
+}
+/ Create_Process succeeded, /{
+  # 7/17 10:42:21 (pid:26855) Create_Process succeeded, pid=26858
+  #
+  for (i=1; i<NF; i++) {
+    if ($i=="Create_Process") {
+      changenr=i;
+      break;
+    }
+  }
+  pidstr=$(changenr+2);
+  split(pidstr,pidarr,"=");
+  pid=pidarr[2];
+  #print  $1,$2,"PID:",pid
+
+  starttime=convert_date(year,$1,$2);
+  print $1,$2,"Starting job",jid,"from",shadow
+}
+/ Process exited, /{
+  # 7/17 10:50:31 (pid:26855) Process exited, pid=26858, signal=9
+  # 7/17 11:23:04 (pid:23112) Process exited, pid=23114, status=0
+  #
+  for (i=1; i<NF; i++) {
+    if ($i=="Process") {
+      changenr=i;
+      break;
+    }
+  }
+  pidstr=$(changenr+2);
+  reasonstr=$(changenr+3);
+
+  split(reasonstr,reasonarr,"=");
+
+  ended=convert_date(year,$1,$2);
+  if (ended<starttime) { # around new year
+    ended=convert_date(year+1,$1,$2);
+  }
+  joblength=ended-starttime;
+
+  ended_jobs++;
+  total_used+=joblength;
+
+  print $1,$2,"Terminated job",jid,"from",shadow,reasonarr[1],reasonarr[2],"duration",joblength
+  if (reasonarr[1]=="status") {
+    if (reasonarr[2]=="0") {
+      goodputZ+=joblength;
+      goodjobsZ++;
+    } else {
+      goodputNZ+=joblength;
+      goodjobsNZ++;
+    }
+  } else if (reasonarr[1]=="signal") {
+    badputSignal+=joblength;
+    badjobsSignal++
+  } else {
+    badputOther+=joblength;
+    babjobsOther++;
+  }
+
+  # cleanup, so it is not reused by accident
+  jid="";
+  shadow="";
+}
+
+########################################################################
+END {
+  print "=================";
+  print "Total jobs",ended_jobs,"utilization",total_used;
+  print "Total goodZ jobs",goodjobsZ " (" percent(goodjobsZ,ended_jobs) "%)","utilization",goodputZ " (" percent(goodputZ,total_used) "%)";
+  print "Total goodNZ jobs",goodjobsNZ " (" percent(goodjobsNZ,ended_jobs) "%)","utilization",goodputNZ " (" percent(goodputNZ,total_used) "%)";
+  print "Total badSignal jobs",badjobsSignal " (" percent(badjobsSignal,ended_jobs) "%)","utilization",badputSignal " (" percent(badputSignal,total_used) "%)";
+  print "Total badOther jobs",badjobsOther " (" percent(badjobsOther,ended_jobs) "%)","utilization",badputOther " (" percent(badputOther,total_used) "%)";
+}