Browse files

updated docs

  • Loading branch information...
1 parent fe2c727 commit 085dbca0937e75f5d4882c7e2824764a25ed3b58 Micha Niskin committed Aug 9, 2010
Showing with 12 additions and 0 deletions.
  1. +12 −0 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
+### 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,

0 comments on commit 085dbca

Please sign in to comment.