Skip to content

Make PROJECT parsing expression more conciseΒ #861

@mjbear

Description

@mjbear

Is your feature request related to a problem? Please describe.
This is not a problem and should be considered an enhancement idea.

Describe the solution you'd like
I'd like to make one of the parsing expressions more concise and possibly shave a few milliseconds off by using awk for most if not all of the expression.

🎯 Though for me to reliably submit a PR with the modification for Arista's review I'll need an example ACCESS_INFO.yaml file.
😎 (Bogus data as long as it is formatted the same as an actual file is sufficient. Please 😁)

Could one of the Arista team please share the format of /etc/atd/ACCESS_INFO.yaml?

Describe alternatives you've considered
One option is to parse with awk and pipe that to cut, but it may be possible to perform with just awk.
PROJECT=$(awk '/project/{print $1}' /etc/atd/ACCESS_INFO.yaml | cut -d':' -f2)

I'm open to other suggestions.

Additional context
(What was done here isn't wrong, but does pipe through several commands. I'd like to hack on it to try and make a shorter expression.)

PROJECT=$(cut -d':' -f2 <<<$(grep project /etc/atd/ACCESS_INFO.yaml) | awk '{print $1}')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions