Search This Blog

Tuesday, August 30, 2011

Awk: Using getline to read a file in BEGIN

Example reading in the password file into an array for later use.
BEGIN {
        FS=":";
        while ((getline  < "/etc/passwd")  >;0 )
        {
                Alias[$1]=$0;
        }
}