- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- LC_TIME values
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2006 08:06 PM
01-05-2006 08:06 PM
Hi,
i want customize the output of "ll" for have the day date on 2 digit.
i saw "ll" take the format by LC_TIME value, so, i tried to customize my locales but i don't know what i must modify in the locale source, i already made:
# cd /usr/lib/nls/loc/
# cp fr_FR.iso885915.src test.src
modify the paragraph LC_TIME
# localedef -v -c -i test.src test
# export LANG=test LC_ALL=test
i verified the new parameters by
# locale LC_TIME
"Dim";"Lun";"Mar";"Mer";"Jeu";"Ven";"Sam"
"Dimanche";"Lundi";"Mardi";"Mercredi";"Jeudi";"Vendredi";"Samedi"
"toto";"fevr";"mars";"avr";"mai";"juin";"juil";"aout";"sept";"oct";"nov";"dec"
"janvier";"fevrier";"mars";"avril";"mai";"juin";"juillet";"aout";"septembre";"octobre";"novembre";"decembre"
"%A %d %B %Y %H:%M:%S"
"%A %d %B %Y"
"%H:%M:%S"
"";""
"%H:%M:%S"
""
""
""
""
""
""
""
""
""
""
now, "ll" modify correctly the month, "Jan" is view as "toto" (it was for test) but the day of the date is already on 1 digit for the firsts month's days
i have:
dr-xr-xr-x 13 bin bin 4096 tato 5 12:00 /var/sam
i want:
dr-xr-xr-x 13 bin bin 4096 tato 05 12:00 /var/sam
i think i must add another parameter but i don't know what.
is there somebody for help please?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2006 10:15 PM
01-05-2006 10:15 PM
Re: LC_TIME values
Under the LC_TIME section in the src file, there are 2 lines that correspond to date format (d_fmt d_t_fmt) and they contain the text:
........
the reference to
........
Let us know how you get on
All the best - Keith
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2006 11:36 PM
01-05-2006 11:36 PM
Re: LC_TIME values
i already try that as you can see above (the result of "locale LC_TIME"), but "ll" does not appear to use this field.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2006 12:04 AM
01-06-2006 12:04 AM
Re: LC_TIME values
I have %e in my locale which is understandable as the day is expressed as " 1" -> "31" (ie. single dates are padded with spaces rather than 0).
Can you specify 2d rather than just d? That would be equivalent to date +%.2d. If this doesn't work I'd suggest that ll may not use locales for that field as it is numerical.
KB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2006 12:54 AM
01-06-2006 12:54 AM
SolutionFirst, two print with zero-fill you would specify a format like:
# date '+%02d'
Next, you might only want to make this change for the 'ls' ('ll') binary rather than system-wide. Here's a variation of a piece of code from an old HP Developer newletter that offers just this kind of ability. The original idea is not mine, but here's a modification to fit your need:
# cat /tmp/nll
#!/usr/bin/sh
# cat nll
# This script checks if a /var/tmp/ls.cat message catalog exists,
# and if not, creates one where the display formats of ls(1) are
# changed to zero-fill the day of the month.
#
# "Jan 06 08:23"
#
# It then proceeds to run ll(1) using this modified message catalog.
# Note that if root should run this, a secure locations should be
# used instead of /var/tmp.
# Usage: <script-name>
# e.g.: ./nll /etc/passwd
if [ ! -s /var/tmp/ls.cat ]; then
echo Creating /var/tmp/ls.cat >&2
dumpmsg /usr/lib/nls/msg/C/ls.cat |
sed -e "s/%b %2d/%b %02d/" |
gencat /var/tmp/ls.cat -
fi
export NLSPATH="/var/tmp/%N.cat"
exec ll "$@"
Regards!
...JRF...
- Tags:
- ls.cat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2006 12:57 AM
01-06-2006 12:57 AM
Re: LC_TIME values
the correct value to put is +%d see below:
# date +%1.d
6
# date +%d
06
# date +%.2d
06
# date +%2.d
6
in the man ls for hpux 11iv1 (http://docs.hp.com/en/B2355-90689/ls.1.html)
there is:
LC_TIME determines the date and time strings output by the -g, -l (ell), -n, and -o options.
so, i can't explain why i do not arrive to do why i want.
i just try something stupid, just for test:
source LC_CTIME:
##################################
# Set up the LC_TIME category
# d_t_fmt "%A %d %B %Y %H:%M:%S"
# d_fmt "%A %d %B %Y"
# t_fmt "%H:%M:%S"
# t_fmt_ampm "%H:%M:%S"
LC_TIME
d_t_fmt "
d_fmt "
t_fmt "
t_fmt_ampm "
day "
"
"
"
"
"
"
abday "
"
"
"
"
"
"
mon "
"
"
"
"
"
"
"
"
"
"
"
abmon "
"
"
"
"
"
"
"
"
"
"
"
am_pm "";""
year_unit "
mon_unit "
day_unit "
hour_unit "
min_unit "
sec_unit "
era_d_fmt "
era "
era_t_fmt "
era_d_t_fmt "
alt_digits "
END LC_TIME
# localedef -v -c -i .src test
# export LANG=test LC_ALL=test
# locale -a |grep test
test
# locale
LANG=test
LC_CTYPE="test"
LC_CO...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2006 01:26 AM
01-06-2006 01:26 AM
Re: LC_TIME values
is there a way for modify ls usage directly?
i tried to modify directly the file /usr/lib/nls/msg/C/ls.cat like the script do but that does not work.
thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2006 01:35 AM
01-06-2006 01:35 AM
Re: LC_TIME values
my problem is solved now and i'm happy ;)
but "ll" does not respect its man page ;(
thanks a lot JRF.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2006 01:36 AM
01-06-2006 01:36 AM
Re: LC_TIME values
Using the modified output of 'dumpmsg' provides the input to 'gencat' which is used to regenreate a catalog file. See the manpages for more information.
Regards!
...JRF...