fixed old version, added new version with awk function