NL_LANGINFO(3am)
β¨ NL_LANGINFO(3am) β¨
okay bestie, we're doing a GNU Awk Extension Modules page today and it's honestly a little cutie π it's the nl_langinfo extension and it's here to make your awk speak every language on earth. periodt.
πΈ NAME πΈ
nl_langinfo</p> β retrieve locale-specific information strings π¦
π SYNOPSIS π
@load "nl_langinfo"
result = nl_langinfo(LANGINFO["variable"])
π DESCRIPTION π
so. the nl_langinfo extension gives AWK a whole interface to the C library routine nl_langinfo(3). the way it does that is it adds two things:
- a single function named
nl_langinfo() - an array named
LANGINFO
The single argument in a call to nl_langinfo() should be one of the available values in the LANGINFO array. yes bestie, literally one arg, that's the whole vibe check.
The return value is the requested string, or the empty string if an error occurred π (no exceptions, no drama, just an empty string, so keep an eye out).
The indices of LANGINFO are the names of various available strings as given in the POSIX standard: see http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html. For example, "D_T_FMT" is the current locale's date and time format for use with strftime(3). See the standard for the full list β it's giving β¨reference materialβ¨, iykyk.
π₯ EXAMPLE π₯
@load "nl_langinfo"
# print the time and date in the locale's format
BEGIN {
print strftime(nl_langinfo(LANGINFO["D_T_FMT"]))
}
not me printing the date in whatever locale the user happens to be in, no cap, that's main character energy π
π SEE ALSO π
- GAWK: Effective AWK Programming,
nl_langinfo(3).
π AUTHOR π
Arnold Robbins, arnold@skeeve.com.
π COPYING PERMISSIONS π
Copyright Β© 2012, 2013, Free Software Foundation, Inc. Copyright Β© 2015, Arnold David Robbins.
Permission is granted to make and distribute verbatim copies of this manual page provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual page under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Foundation.
β οΈ yes this whole block is the legal bit and it is non-negotiable β keep the notices intact, bestie, that's the rules π
okay that's the whole page, mwah π this one's from the Jun 01 2015 era of the GNU Awk Extension Modules docs π«Ά go forth and be locale-aware, slay πβ¨
π¦ where this page comes from
- fedora 43: gawk-nl_langinfo 1.1.0-22.fc43 Β· GPL-3.0-or-later
- fedora 44: gawk-nl_langinfo 1.1.0-23.fc44 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms