Issues parsing "hammer --csv" command output with awk command on Satellite 6.2, 6.3

Solution In Progress - Updated -

Issue

When using the awk command to parse the columns of a Satellite hammer --csv command, unpredictable results can occur if the values of some of the fields contain commas themselves.

For example, this command might not correctly display the 9th column of the output if the subscription names have different numbers of commas in their names:

# hammer --csv subscription list --organization example | awk -F, '{print $9}'
Quantity
2019/04/26 03:59:59
25

In the example above, the intention was to use awk to display the 9th field (Quantity) for each subscription (in this example, there are 2 subscriptions), however, the output shows 2019/04/26 03:59:59 which is the End Date (8th field) on one of the lines rather than the Quantity. The next line, 25, displays the Quantity correctly.

Environment

  • Red Hat Satellite 6.2, 6.3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.