|
さきほどお問い合わせページよりご指摘いただきました、ジャンル一覧リンク切れの件、 修正しました。ご指摘ありがとうございます>連絡いただいた方 |
|
2年半ぶりの人材募集です。 http://x68000.q-e-d.net/~68user/tmp/job2.html |
|
こんにちわ。 findコマンドについて教えてください。 ■要件 カレントディレクトリに存在する31日以前のファイル&ディレクトリの削除を実施したい ■コマンド find ./ -mtime +31 -exec ls {} \; -exec rm -r {} \; >> test.log ■結果 ./20070101.trc find: ./aaa: No such file or directory ■質問1 カレントディレクトリに削除対象となる日付のファイル20070101.trcとディレクトリaaaを配置しています。 削除ファイルの一覧を取得したいため-exec ls {} \;を使用したのですが、 ログには./20070101.trcしか記載がありません。 ディレクトリも表示させるには何かオプションが必要なのでしょうか? ■質問2 実行結果としては削除は行われているのですが戻り値がエラーとなっています。 find: ./aaa: No such file or directoryの部分を指していると思うのですが、 削除後にfindしているように見受けられますがこのエラーの出力原因はなんでしょうか? 1と2の解決方法がありましたら教えてください。 宜しくお願いします。 |
|
>>4902 TKC まず、-exec の代わりに -ok を使って何が実行されているか確認しましょう。 > ディレクトリも表示させるには何かオプションが必要なのでしょうか? ./aaa/ の中身が空ではないですか? 空であれば ls ./aaa しても何も 表示されないと思います。 > 削除後にfindしているように見受けられますがこのエラーの出力原因は > なんでしょうか? find はディレクトリを下降してファイルを探しますが、おそらく ディレクトリを削除した後にそのディレクトリに下りようとしている のではないでしょうか。-prune を組み合わせれば下りないように できるかもしれません (試していません)。 |
|
>>4903 68userさん -okを使用して確認しました。 ご察しの通り./aaa配下が空のため< ls ... ./aaa >となり 結果的にログに./aaaが出力されていないことがわかりました。 findのエラー原因はやはり削除後に配下に移動しているものと思われます。 rmにデータが渡る前に-pruneを使い解消されました。 最終的には下記で行いたい処理ができました。 find ./ -mtime +31 -prune -exec ls -d {} \; -exec rm -r {} \; どうもありがとうございました。 |
|
いつもこちらにはお世話になってます。 flexについての指摘です。 http://x68000.q-e-d.net/~68user/unix/pickup?flex GNUでは作成・配布してないようです。 http://ftp.gnu.org/gnu/flex/flex.README |
|
>>4906 hoge > GNUでは作成・配布してないようです。 そうなんですか。知りませんでした。 ftp://ftp.gnu.org/non-gnu/flex/flex.README Flex is a free implementation of the well-known Lex program for lexical analysis. Since it is not (and never was) a GNU package, we don't distribute it here. Please see http://flex.sourceforge.net for the latest release and information. や flex-2.5.4 (1997年リリース) の README Note that flex is distributed under a copyright very similar to that of BSD Unix, and not under the GNU General Public License (GPL), except for the "configure" script, which is covered by the GPL. などを見るに、確かに flex が GNU ではないようですね。 しかしこの書籍 http://www.ascii.co.jp/books/books/detail/4-7561-3097-6.shtml Flex入門 シリーズ:GNUシリーズ GNUのツールの1つとして広く使用されているGNUのLexical Scanner Generatorで あるFlexの解説書。豊富な例とともに機能を詳細解説 はどうなんですかね。 wikipedia(en) には http://en.wikipedia.org/wiki/Flex_lexical_analyser Flex is a non-GNU project, but the GNU project developed the manual for Flex. とありますが、「GNU が作った flex のマニュアル」の翻訳が上記の「Flex 入門」 だったりするんでしょうか。 |
|
>>4907 68user うーん、やはり 2.5.3 以前は GNU だったのだろうか。 http://cocoa.2ch.net/unix/kako/970/970914036.html より ----- ここから ----- Flex はそもそも non-gnuに移動になって、 下の Flex 2.5.4の COPYING みたいなことになっている。 -=-=-=-=- Flex carries the copyright used for BSD software, slightly modified because it originated at the Lawrence Berkeley (not Livermore!) Laboratory, which operates under a contract with the Department of Energy: Copyright (c) 1990 The Regents of the University of California. All rights reserved. This code is derived from software contributed to Berkeley by Vern Paxson. The United States Government has rights in this work pursuant to contract no. DE-AC03-76SF00098 between the United States Department of Energy and the University of California. Redistribution and use in source and binary forms with or without modification are permitted provided that: (1) source distributions retain this entire copyright notice and comment, and (2) distributions including binaries display the following acknowledgement: ``This product includes software developed by the University of California, Berkeley and its contributors'' in the documentation or other materials provided with the distribution and in all advertising materials mentioning features or use of this software. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. This basically says "do whatever you please with this software except remove this notice or take advantage of the University's (or the flex authors') name". Note that the "flex.skl" scanner skeleton carries no copyright notice. You are free to do whatever you please with scanners generated using flex; for them, you are not even bound by the above copyright. ----- ここまで ----- 「non-gnu に移動」という記述はいろんなところにあるが、それを根拠に 「以前は GNU だった」と言いきれない。古い tarball も見つからないし…。 |
|
>>4908 68user > うーん、やはり 2.5.3 以前は GNU だったのだろうか。 flex-2.5.2/COPYING を確認しましたが、 >> 下の Flex 2.5.4の COPYING みたいなことになっている。 とほぼ同じでした。よって、以前は flex は GNU であったが、 ある時点から GNU でなくなった、などという事実はないようです。 |
|
>>4907 68user > http://www.ascii.co.jp/books/books/detail/4-7561-3097-6.shtml > Flex入門 > シリーズ:GNUシリーズ 後はこれだけが気になってしょうがないので、アスキーに「なぜ GNU シリーズなのか」という 問い合わせを投げました。返事来るといいなぁ。 # その前に訳者と思われる方にメールを投げたものの、user unknown で返ってきました。 |
|
問題を投げっぱなしにしてすいません。 PHPのコンパイルに必要だったので探していただけで、 flexについては全く知らないんです^^; > 「GNU が作った flex のマニュアル」の翻訳が上記の「Flex 入門」 > だったりするんでしょうか。 http://www.gnupress.org/book11.html GNU Press「Flex: The Lexical Scanner Generator」 http://www.asahi-net.or.jp/~wg5k-ickw/html/online/flex-2.5.4/flex_1.html 訳者の方による、「Flex入門」と同内容のページだと思われます。 ISBNの記述から、ご推察のとおり 「GNU が作った flex のマニュアル」の翻訳が「Flex 入門」 だと考えますが、いかがでしょうか。 |
|
http://x68000.q-e-d.net/~68user/net/net-1.html の[ホスト名とは?]を読んでいましたら、http//133.8.2.24/でhttp//www.cs.gunma-u.ac.jp と同じページが表示されるはずですと なっていますがが、http//133.8.3.11/でないと表示されないように思います。参考にさせて頂いています。 |
|
>>4912 hoge flex については更新しております。ご指摘ありがとうございます。 http://x68000.q-e-d.net/~68user/unix/pickup?flex 「GNU シリーズ」についてはアスキーより回答をいただいたのですが、 残念ながら Web での公開は不可とのことなので、墓場まで持っていき たいと思います。 >>4913 BK ありがとうございます。取り急ぎ IP アドレスのみ更新しました。 |
|
shで、文字列から文字列を取り出そうとしています。 ”aaa.bbb@test.cojp” から「@」より前と後を、 ”aaa.bbb" と ”@test.co.jp” を取り出したいのです。 どのようにすれば良いか教えてください。 |