0

I came across this sed command in a script to compare a machine's local binaries to GTFObins binaries.

    for i in $(curl -s https://gtfobins.github.io/ | html2text | cut -d" " -f1 | sed '/^[[:space:]]*$/d');
do 
    if grep -q "$i" installed_pkgs.list;
    then 
        echo "Check GTFO for: $i";
    fi;
done

I have tested it and found that it deletes the spaces between lines, but I don't understand its form or how it is written.

M4raa
  • 13

1 Answers1

2

Matches any line that only contains space characters between the beginning (^) and the end ($) of a line.

https://regex101.com/ is your friend.

/…/d instructs sed to delete any match, so this just eliminates empty lines (as in: no content, or only spaces, tabs and similar on the line) from the input).