ALT Linux sysadmins discussion
 help / color / mirror / Atom feed
* [Sysadmins] Date format
@ 2008-06-27 13:53 Aleksey E. Birukov
  2008-06-27 17:10 ` Aleksey E. Birukov
  0 siblings, 1 reply; 3+ messages in thread
From: Aleksey E. Birukov @ 2008-06-27 13:53 UTC (permalink / raw)
  To: sysadmins

Нужно перевести даты из лог файла формата "20.06.2008" в unix time.
Загвоздка в том, что date -d ... +%s понимает только (?) формат
"2008-06-20". Другого я от него добиться не смог сколько маны не читал.
Есть ли возможность простым способом переформатировать даты?




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Sysadmins] Date format
  2008-06-27 13:53 [Sysadmins] Date format Aleksey E. Birukov
@ 2008-06-27 17:10 ` Aleksey E. Birukov
  2008-06-27 20:21   ` Sergey Shilov
  0 siblings, 1 reply; 3+ messages in thread
From: Aleksey E. Birukov @ 2008-06-27 17:10 UTC (permalink / raw)
  To: ALT Linux sysadmin discuss

Aleksey E. Birukov пишет:
> Нужно перевести даты из лог файла формата "20.06.2008" в unix time.
> Загвоздка в том, что date -d ... +%s понимает только (?) формат
> "2008-06-20". Другого я от него добиться не смог сколько маны не читал.
> Есть ли возможность простым способом переформатировать даты?
Сделал так:
echo "21.06.08 text" | sed 's/^\(..\)\.\(..\)\.\(..\)/20\3-\2-\1/g'



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Sysadmins] Date format
  2008-06-27 17:10 ` Aleksey E. Birukov
@ 2008-06-27 20:21   ` Sergey Shilov
  0 siblings, 0 replies; 3+ messages in thread
From: Sergey Shilov @ 2008-06-27 20:21 UTC (permalink / raw)
  To: sysadmins

В сообщении от Friday 27 June 2008 20:10:36 Aleksey E. Birukov написал(а):
> echo "21.06.08 text" | sed 's/^\(..\)\.\(..\)\.\(..\)/20\3-\2-\1/g'
Наверное лучше чуть "построже"
sed 's/\([0-3][0-9]\)\.\([0,1][0-9]\)\.\(0[0-9]\)/20\3-\1-\2/g'

-- 
С уважением
Сергей Шилов.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-06-27 20:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-27 13:53 [Sysadmins] Date format Aleksey E. Birukov
2008-06-27 17:10 ` Aleksey E. Birukov
2008-06-27 20:21   ` Sergey Shilov

ALT Linux sysadmins discussion

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sysadmins/0 sysadmins/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sysadmins sysadmins/ http://lore.altlinux.org/sysadmins \
		sysadmins@lists.altlinux.org sysadmins@lists.altlinux.ru sysadmins@lists.altlinux.com
	public-inbox-index sysadmins

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sysadmins


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git