diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-12-01 23:07:07 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-12-01 23:07:07 +0100 |
commit | c1581e769105967b1c10114027a1fb2027c1e80c (patch) | |
tree | 8110e663833a5d371a9c7eb543c71a91cb192fee | |
parent | update dist (diff) | |
download | median-c1581e769105967b1c10114027a1fb2027c1e80c.tar.gz median-c1581e769105967b1c10114027a1fb2027c1e80c.tar.bz2 median-c1581e769105967b1c10114027a1fb2027c1e80c.tar.xz |
misc improvements1.2
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | COPYING | 2 | ||||
-rw-r--r-- | Makefile | 70 | ||||
-rw-r--r-- | README | 63 | ||||
-rw-r--r-- | doc/info/fdl.texinfo (renamed from info/fdl.texinfo) | 0 | ||||
-rw-r--r-- | doc/info/median.texinfo (renamed from info/median.texinfo) | 0 | ||||
-rw-r--r-- | doc/man/median.1 | 64 |
7 files changed, 154 insertions, 50 deletions
@@ -1,11 +1,12 @@ _/ -bin/ -obj/ +/bin/ +/obj/ __pycache__/ \#*\# .* !.git* *~ +*.new *.bak *.swo *.swp @@ -1,5 +1,5 @@ median — Calculate the median values for a set of groups -Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) +Copyright © 2014, 2015 Mattias Andrée (maandree@member.fsf.org) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,6 +11,8 @@ BINDIR = $(PREFIX)$(BIN) DATADIR = $(PREFIX)$(DATA) DOCDIR = $(DATADIR)/doc INFODIR = $(DATADIR)/info +MANDIR = $(DATADIR)/man +MAN1DIR = $(MANDIR)/man1 LICENSEDIR = $(DATADIR)/licenses COMMAND = median @@ -28,75 +30,90 @@ all: doc doc: info pdf dvi ps .PHONY: info -info: median.info -%.info: info/%.texinfo info/fdl.texinfo +info: bin/median.info +bin/%.info: doc/info/%.texinfo doc/info/fdl.texinfo + @mkdir -p bin makeinfo $< + mv $*.info $@ .PHONY: pdf -pdf: median.pdf -%.pdf: info/%.texinfo info/fdl.texinfo - @mkdir -p obj/pdf - cd obj/pdf ; yes X | texi2pdf ../../$< - mv obj/pdf/$@ $@ +pdf: bin/median.pdf +bin/%.pdf: doc/info/%.texinfo doc/info/fdl.texinfo + @mkdir -p obj/pdf bin + cd obj/pdf ; texi2pdf ../../$< < /dev/null + mv obj/pdf/$*.pdf $@ .PHONY: dvi -dvi: median.dvi -%.dvi: info/%.texinfo info/fdl.texinfo - @mkdir -p obj/dvi - cd obj/dvi ; yes X | $(TEXI2DVI) ../../$< - mv obj/dvi/$@ $@ +dvi: bin/median.dvi +bin/%.dvi: doc/info/%.texinfo doc/info/fdl.texinfo + @mkdir -p obj/dvi bin + cd obj/dvi ; $(TEXI2DVI) ../../$< < /dev/null + mv obj/dvi/$*.dvi $@ .PHONY: ps -ps: median.ps -%.ps: info/%.texinfo info/fdl.texinfo - @mkdir -p obj/ps - cd obj/ps ; yes X | texi2pdf --ps ../../$< - mv obj/ps/$@ $@ +ps: bin/median.ps +bin/%.ps: doc/info/%.texinfo doc/info/fdl.texinfo + @mkdir -p obj/ps bin + cd obj/ps ; texi2pdf --ps ../../$< < /dev/null + mv obj/ps/$*.ps $@ .PHONY: install -install: install-base install-info +install: install-base install-info install-man .PHONY: install install-all: install-base install-doc .PHONY: install-base -install-base: install-command install-license +install-base: install-command install-copyright .PHONY: install-command install-command: install -dm755 -- "$(DESTDIR)$(BINDIR)" install -m755 src/median -- "$(DESTDIR)$(BINDIR)/$(COMMAND)" +.PHONY: install-copyright +install-copyright: install-copying install-license + +.PHONY: install-copying +install-copying: + install -dm755 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + install -m644 COPYING -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + .PHONY: install-license install-license: install -dm755 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" - install -m644 COPYING LICENSE -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + install -m644 LICENSE -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" .PHONY: install-doc -install-doc: install-info install-pdf install-ps install-dvi +install-doc: install-info install-pdf install-ps install-dvi install-man .PHONY: install-info -install-info: median.info +install-info: bin/median.info install -dm755 -- "$(DESTDIR)$(INFODIR)" install -m644 $< -- "$(DESTDIR)$(INFODIR)/$(PKGNAME).info" .PHONY: install-pdf -install-pdf: median.pdf +install-pdf: bin/median.pdf install -dm755 -- "$(DESTDIR)$(DOCDIR)" install -m644 $< -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).pdf" .PHONY: install-ps -install-ps: median.ps +install-ps: bin/median.ps install -dm755 -- "$(DESTDIR)$(DOCDIR)" install -m644 $< -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).ps" .PHONY: install-dvi -install-dvi: median.dvi +install-dvi: bin/median.dvi install -dm755 -- "$(DESTDIR)$(DOCDIR)" install -m644 $< -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).dvi" +.PHONY: install-man +install-man: doc/man/median.1 + install -dm755 -- "$(DESTDIR)$(MAN1DIR)" + install -m644 $< -- "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1" + .PHONY: uninstall @@ -109,10 +126,11 @@ uninstall: -rm -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).pdf" -rm -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).ps" -rm -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).dvi" + -rm -- "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1" .PHONY: clean clean: - -rm -r obj bin *.info *.pdf *.dvi *.ps + -rm -r obj bin @@ -1,22 +1,43 @@ -Calculate the median values for a set of groups. - - -median takes the first blank space-separated column -values and the remainder as keys. It will then print -the median for each key. As a side effect median will -will print the result sorted by the keys. - -Usage example: - -$ cat <<EOF | median -+003 c -.001 a --002 b -+001 c --001 b -+002 c -EOF -.001 a --001.5 b -+002 c +NAME + median - Calculate the median values for a set of groups + +SYNOPSIS + median < INPUT + +DESCRIPTION + median takes the first blank space-separated column values + and the remainder as keys. It will then print the median for + each key. As a side effect median will print the result + sorted by the keys. + +EXAMPLES + $ cat <<EOF | median + -10 + 2 + 4 + 3 + 50 + EOF + 3 + + $ cat <<EOF | median + +003 c + .001 a + -002 b + +001 c + -001 b + +002 c + EOF + .001 a + -001.5 b + +002 c + +RATIONALE + Combining sort(1), sed(1), wc(1), expr(1) to do this is + too much work to do on a regular basis. + +SEE ALSO + sort(1), expr(1), sets(1) + + Full documentation available locally via: info '(median)' diff --git a/info/fdl.texinfo b/doc/info/fdl.texinfo index cb71f05..cb71f05 100644 --- a/info/fdl.texinfo +++ b/doc/info/fdl.texinfo diff --git a/info/median.texinfo b/doc/info/median.texinfo index 1255902..1255902 100644 --- a/info/median.texinfo +++ b/doc/info/median.texinfo diff --git a/doc/man/median.1 b/doc/man/median.1 new file mode 100644 index 0000000..b684304 --- /dev/null +++ b/doc/man/median.1 @@ -0,0 +1,64 @@ +.TH MEDIAN 1 MEDIAN +.SH NAME +median - Calculate the median values for a set of groups +.SH SYNOPSIS +.B median +< +.I INPUT +.SH DESCRIPTION +.B median +takes the first blank space-separated column values and the remainder +as keys. It will then print the median for each key. As a side effect +median will print the result sorted by the keys. +.SH EXAMPLES +.nf +$ cat <<EOF | median +\-10 +2 +4 +3 +50 +EOF +3 +.fi +.PP +.nf +$ cat <<EOF | median +\+003 c +\&.001 a +\-002 b +\+001 c +\-001 b +\+002 c +EOF +\&.001 a +\-001.5 b +\+002 c +.fi +.SH RATIONALE +Combining +.BR sort (1), +.BR sed (1), +.BR wc (1), +.BR expr (1) +to do this is too much work to do on a regular basis. +.SH "SEE ALSO" +.BR sort (1), +.BR expr (1), +.BR sets (1) +.PP +Full documentation available locally via: info \(aq(median)\(aq +.SH AUTHORS +Principal author, Mattias Andrée. See the COPYING file for the full +list of authors. +.SH LICENSE +Copyright \(co 2014, 2015 Mattias Andrée +.br +License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. +.br +This is free software: you are free to change and redistribute it. +.br +There is NO WARRANTY, to the extent permitted by law. +.SH BUGS +Please report bugs to https://github.com/maandree/median/issues or to +maandree@member.fsf.org |