makepac/sort_acl.sh

9 lines
253 B
Bash
Raw Normal View History

2023-02-13 18:23:46 -05:00
#!/usr/bin/bash
# Sorts the output of getfacl records to stdout
# Assumes filenames don't contain + and |
awk '
BEGIN { RS="\n\n"; FS="\n"; ORS="\n"; OFS="|"}
// { $2=$2; print }
' | sort -k 1,1 -t '|' | tr '\n' '+' | sed 's/+/\n\n/g' | sed 's/|/\n/g'