Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make PROJECT parsing expression more concise #861

Open
mjbear opened this issue Aug 18, 2024 · 1 comment
Open

Make PROJECT parsing expression more concise #861

mjbear opened this issue Aug 18, 2024 · 1 comment

Comments

@mjbear
Copy link

mjbear commented Aug 18, 2024

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}')

@mjbear
Copy link
Author

mjbear commented Aug 18, 2024

Note: In the past I submitted similar awk expression enhancements to aristanetworks/avd-workshops#152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant