|
>> 4974 環境を書き忘れました。 環境は、 Solaris8 Perl v5.8.5 |
|
>>4974 べた >>4975 べた Solaris なら適当なファイルを作って、touch コマンドでタイムスタンプを 前日 08:59:59 にしておいて、find . -newer foo とするのが一番簡単かと 思います。 FreeBSD なら find -mtime -99h とか、Linux なら find -mmin -9999 とか できますが (99 や 9999 は計算して求める)、結局は -newer の方が簡単な 気がします。 モジュール使うなら File::Find http://perldoc.perl.org/File/Find.html File::Find::Rule http://search.cpan.org/~rclamp/File-Find-Rule-0.28/lib/File/Find/Rule.pm あたりかと思いますが、いずれも前日9時と比較する部分は手で書かないと いけないように見えますので、イマイチですね。 |
|
>>4976 68user ありがとうございます。 また、返事が遅くなって申し訳ありません。 > find . -newer foo ですか。 シェルで、findの結果を取得することも考えました。 > あたりかと思いますが、いずれも前日9時と比較する部分は手で書かないと > いけないように見えますので、イマイチですね。 Perlを使おうとしていたので、手で書かなくてはいけないと思っていました この部分の良い方法が実現できなくて。 環境上、教えて頂いたモジュールも入れることができません。 |
|
>>4977 べた find . -newer foo の方法を書いておきます。find を使わないなら、 昨日9時の日時 (20090323090000) を Time::Local で epoch time に 直しておき、stat() が返す最終更新時刻と比較すればよいでしょう。 ------ my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time()-60*60*24); my $timestamp = sprintf("%04d%02d%02d%02d%02d.%02d", $year+1900, $mon+1, $mday, 9, 0, 0); my $yeasterday_9am_file = "foo.txt"; system("touch -t $timestamp $yeasterday_9am_file"); open(IN, "find . -type f -newer $yeasterday_9am_file |"); while (<IN>){ chomp; print "$_\n"; } |
|
>> 4978 ありがとうございます。 教えていただいた方法ですと、前日9時のタイムスタンプの 取得をPerlでやればあとは、シェルスクリプトでもできます ね。 実のところ、findを使わない、Perlでの記述、遣り方を教えて ほしいのですが。 |
|
>>4978 68user > find を使わないなら、 > 昨日9時の日時 (20090323090000) を Time::Local で epoch time に > 直しておき、stat() が返す最終更新時刻と比較すればよいでしょう。 Time::Local で epoch time に直しての「epoch time」とは なんでしょうか。 |
|
linuxのCでグラフィックの勉強がしたくてX-Windowまで辿り着いたのはよかったんですが、 ここ↓のソースを実行させようとしても何故かエラーが出てしまいます。 http://x68000.q-e-d.net/~68user/xprogram/xlib-4.html 一応類似の記事がないかどうか調べて見ましたが、 No.8552が近いと思いましたが全然分かりませんでした。 ちゃんとusr/include/X11ファイルに Xlib.hとXutil.hはありますし、 コンパイルオプションも活用してみました…… Xlib.hとXutil.hの意味も分からなくて困窮中です…… コマンドラインは、gcc -o xlib-4-1 xlib-4-1.c -I /usr/include/X11 -L /usr/include/X11 エラーは以下の文です /tmp/cc2pF4g1.o: In function `main': xlib-4-1.c:(.text+0x9f): undefined reference to `XOpenDisplay' xlib-4-1.c:(.text+0x149): undefined reference to `XCreateSimpleWindow' xlib-4-1.c:(.text+0x198): undefined reference to `XSetStandardProperties' xlib-4-1.c:(.text+0x1c0): undefined reference to `XCreateGC' xlib-4-1.c:(.text+0x1e8): undefined reference to `XSetBackground' xlib-4-1.c:(.text+0x20a): undefined reference to `XSetForeground' xlib-4-1.c:(.text+0x232): undefined reference to `XCreateGC' xlib-4-1.c:(.text+0x25a): undefined reference to `XSetBackground' xlib-4-1.c:(.text+0x27c): undefined reference to `XSetForeground' xlib-4-1.c:(.text+0x294): undefined reference to `XMapRaised' xlib-4-1.c:(.text+0x2ec): undefined reference to `XFillArc' xlib-4-1.c:(.text+0x344): undefined reference to `XFillArc' xlib-4-1.c:(.text+0x352): undefined reference to `XFlush' collect2: ld はステータス 1 で終了しました |
|
>>4982 ちびヴァル オプション -lX11 が足りていません。まずは http://x68000.q-e-d.net/~68user/xprogram/xlib-1.html からどうぞ。 |