Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated docs

  • Loading branch information...
commit 085dbca0937e75f5d4882c7e2824764a25ed3b58 1 parent fe2c727
Micha Niskin authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 README.markdown
View
12 README.markdown
@@ -320,6 +320,18 @@ a single string containing all of the person's sports, separated by commas.
Notice how altering the `this` object in place alters the result array
accordingly.
+### Extract Only The "Age" Property Of Each Element ###
+
+Normally we would modify the input set in place, by manipulating the `this`
+object, which would be returned by default after each iteration. However,
+sometimes we want only a single field from the input set.
+
+ cat /tmp/t | jsawk 'return this.age'
+
+Putting a return statement in the script expression causes the default
+return of `this` to be short-circuited, replacing this element with the
+return value in the output set.
+
### JSON Grep: Select Certain Elements From Input ###
Sometimes you want to use awk to select certain records from the input set,
Please sign in to comment.
Something went wrong with that request. Please try again.