An open API service indexing awesome lists of open source software.

https://github.com/serpent7776/msquare


https://github.com/serpent7776/msquare

awk fun rectangle

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

          

msquare
=======

Small awk script solving following puzzle:

Input is a rectangle of numbers. First row and first column specify target sum
of corresponding column/row. The task is to remove some values from rectangle
so that sums of rows/column match with values given in first column/row. Values
at first row/column cannot be modified.

# 4 10 6 -- these values specifies sums of corresponding columns
2 1 2 3
10 4 5 6
8 7 8 9

|
\- these values specifies sums of corresponding rows

Simple input data is given in simple.data file:

# 4 10 6
2 1 2 3
10 4 5 6
8 7 8 9

Feeding above file to msquare.awk with `cat simple.data | awk -f msquare.awk`
will produce:

# 4 10 6
2 _ 2 _
10 4 _ 6
8 _ 8 _