fork(1) download
  1. #!/bin/bash
  2. item=
  3. while read -r first second _; do
  4. if [[ $first = REQUIRES ]]; then
  5. printf '%s REQUIRES %s\n' "$item" "$second"
  6. else
  7. item=$first
  8. fi
  9. done
Success #stdin #stdout 0.02s 5268KB
stdin
Y
REQUIRES Z
A
REQUIRES B
C
REQUIRES D
REQUIRES E
REQUIRES F
G
REQUIRES H
I
REQUIRES J
stdout
Y REQUIRES Z
A REQUIRES B
C REQUIRES D
C REQUIRES E
C REQUIRES F
G REQUIRES H