![]() When the start index number is omitted, zero is used ( and are identical). Because it is an array, you need to iterate through it to process each record. records) yields three independent objects (with the name and data properties), while the slice generates an array containing the record objects. This is because the comma separated indexing (. You might have noticed the subtle difference from the previous comma separated indexes: The additional is prepended to the. For example, to extract the names (IP addresses) from the top 4 elements in the AOL data-group records, run the following command: curl -sku admin:admin | \Ħ4.12.96.0/19 # The name property value from 0th You can extract a subset of array by slicing: Just specify the start (inclusive) and stop (exclusive) indexes separated by colon ( :) inside the. ![]() Note that jq does not raise any error for an out-of-range index: It silently returns null (just like referencing a non-existing property). In the example below, only the name properties are extracted by additional |. You can specify multiple indexes separated by. The index number starts from 0, so means the 2nd element. You can selectively extract a single element by specifying the array index number to the records property. Here's an example from the AOL internal data-group: curl -sku admin:admin | jq '.records' ![]() For example, the records property of an LTM internal data-group (e.g., tmsh list ltm data-group internal aol) stores as many entries as you want in a single array. Extract an array elementĪ single array may contain a large number of elements. If you find some jq notations difficult, please revisit the Part 1. Additionally, methods for converting Unix epoch timestamps are presented. Toward the end, filters for such row strings are discussed. ![]() iControl REST sometimes returns a bare output from the underlying tmsh (e.g., monitor stats). Part 2 deals with slightly complex use cases: Manipulating array elements, looking for strings that match a certain criteria and handling both property names (keys) and values to generate a tabularized output. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |