Taco Steemers

A personal blog.
☼ / ☾

Notes on AWK

awk - pattern-directed scanning and processing language

Example script to make a <ul> of files found by find

1
2
3
4
5
6
7
#!/bin/bash

find . \( -name "*.md" -o -name "*.markdown" \) | awk -v pwd=$PWD '
    BEGIN{print "<ul>"}
    {printf("<li><a href=\"file://%s%s\">%s</a>",pwd,substr($1,2,length($1)),$1)}
    END{print "</ul>"}
' >> out.html;