diff --git a/c/todo.txt b/c/todo.txt index e84863141..a69763f84 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -7,7 +7,6 @@ ================================================================ FEATURES/+ -!! move lrec_parsers -> readers severally !! mmap impl: csv !! then: --mmap by default !! mmap/stdio UTs; maybe run all cases with --mmap and again with --no-mmap diff --git a/doc/content-for-feature-comparison.html b/doc/content-for-feature-comparison.html index 5bdfb908e..21faa9300 100644 --- a/doc/content-for-feature-comparison.html +++ b/doc/content-for-feature-comparison.html @@ -46,8 +46,10 @@ Its domain-specific languages are limited to the filter and functions are stream functions. This means NF, NR, etc. change from one line to another, $x is a label for field x in the current record, and the input to sqrt($x) changes from one record -to the next. Miller doesn’t let you set, say, sum=0 and then -update that on each record. +to the next. Miller doesn’t let you set sum=0 before +records are read, then update that sum on each record, then print its value at the +end. (However, do see mlr step -a rsum in the +POKI_PUT_LINK_FOR_PAGE(reference.html)HERE) page.)
Miller is faster than awk, cut, and so on (depending on platform; see also POKI_PUT_LINK_FOR_PAGE(performance.html)HERE). In diff --git a/doc/content-for-file-formats.html b/doc/content-for-file-formats.html index 0aa8bb75b..7b7d0c5c1 100644 --- a/doc/content-for-file-formats.html +++ b/doc/content-for-file-formats.html @@ -39,6 +39,40 @@ Miller’s default file format is DKVP, for delimited key-value pairs POKI_RUN_COMMAND{{mlr cat data/small}}HERE Such data are easy to generate, e.g. in Ruby with +POKI_CARDIFY(puts "host=#{hostname},seconds=#{t2-t1},message=#{msg}")HERE +POKI_CARDIFY(puts mymap.collect{|k,v| "#{k}=#{v}"}.join(','))HERE +or print statements in various languages, e.g. +POKI_CARDIFY(echo "type=3,user=$USER,date=$date\n";)HERE +POKI_CARDIFY(logger.log("type=3,user=$USER,date=$date\n");)HERE + + As discussed in POKI_PUT_LINK_FOR_PAGE(record-heterogeneity.html)HERE, Miller handles +changes of field names within the same data stream. But using DKVP format this is particularly +natural. One of my favorite use-cases for Miller is in application/server logs, where I log all sorts +of lines such as + + ++resource=/path/to/file,loadsec=0.45,ok=true +record_count=100, resource=/path/to/file +resource=/some/other/path,loadsec=0.97,ok=false ++
puts mymap.collect{|k,v| "#{k}=#{v}"}.join(',')
diff --git a/doc/feature-comparison.html b/doc/feature-comparison.html
index e4e49a747..d12425e4e 100644
--- a/doc/feature-comparison.html
+++ b/doc/feature-comparison.html
@@ -170,8 +170,10 @@ Its domain-specific languages are limited to the filter and
functions are stream functions. This means NF, NR, etc.
change from one line to another, $x is a label for field x in
the current record, and the input to sqrt($x) changes from one record
-to the next. Miller doesn’t let you set, say, sum=0 and then
-update that on each record.
+to the next. Miller doesn’t let you set sum=0 before
+records are read, then update that sum on each record, then print its value at the
+end. (However, do see mlr step -a rsum in the
+Reference) page.)
Miller is faster than awk, cut, and so on (depending on
platform; see also Performance). In
diff --git a/doc/file-formats.html b/doc/file-formats.html
index cdb5e303b..84eaf8073 100644
--- a/doc/file-formats.html
+++ b/doc/file-formats.html
@@ -95,6 +95,7 @@ Miller commands were run with pretty-print-tabular output format.
• Pretty-printed
+puts "host=#{hostname},seconds=#{t2-t1},message=#{msg}"
+
+
+puts mymap.collect{|k,v| "#{k}=#{v}"}.join(',')
+
++echo "type=3,user=$USER,date=$date\n"; ++
+logger.log("type=3,user=$USER,date=$date\n");
+
++resource=/path/to/file,loadsec=0.45,ok=true +record_count=100, resource=/path/to/file +resource=/some/other/path,loadsec=0.97,ok=false ++
puts mymap.collect{|k,v| "#{k}=#{v}"}.join(',')