Last active
August 29, 2015 13:57
-
-
Save mjf/9364889 to your computer and use it in GitHub Desktop.
shortfacl - Reformat POSIX.1e ACL long form to short form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sed -f | |
# shortfacl - Reformat POSIX.1e ACL long form to short form | |
# Copyright (C) 2014 Matous J. Fialka | |
# Released under the terms of The MIT License | |
# Use as `getfacl /path/to/object | shortfacl` | |
# Remove comments | |
s/#.*$// | |
# Remove trailing whitespace | |
s/[ \t]\+$// | |
# Shorten keywords | |
s/^\(.\)[^:]\+:/\1:/ | |
# Join lines and cleanup | |
s/.*/&,/ | |
H | |
$ { | |
x | |
s/,\n/,/g | |
s/\n\(.*\)/\1/ | |
s/\(.*\),/\1/ | |
s/,\+/,/g | |
s/,$// | |
s/^,// | |
p | |
} | |
d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment