Grok stuff with Grawk!
Grawk is AWK for GitHub Action Pipelines.
It allows running AWK programs in workflow files, imagine setting shell: awk
in a run:
step.
---
name: Run Awk Script
on: push
jobs:
grawk:
name: Run Grawk
runs-on: ubuntu-latest
steps:
- name: Run Grawk
uses: norwd/grawk@v1
with:
program: |
BEGIN {
print "Hello World!"
}
---
name: Run Awk Script
on: push
jobs:
process-students:
name: Process Student Records
runs-on: ubuntu-latest
steps:
- name: Download Student Records
shell: bash
run: |
wget https://raw.githubusercontent.com/norwd/grawk/v1/.github/testing/students.csv
- id: students-named-alex
name: Find Students Named Alex
uses: norwd/grawk@v1
with:
input-file: students.csv
program: |
$1 == "Alex" { # Format is FIRST_NAME, LAST_NAME, AGE, SUBJECT
print $2 ", " $1 ": " $3 " year old " $4 " student"
}
- name: Print Found Students
shell: bash
run: echo "$STUDENTS"
env:
STUDENTS: ${{ steps.students-named-alex.outputs.results }}
The text of the awk program.
The pathname of the file containing an awk program.
The input to the awk program.
The pathname of the file containing the input to the awk program.
The input field separator.
The result of the awk script.