• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

Linux上でファイル名が文字化けする場合があります。

   1  $ ls result.log.*
   2  result.log.Fri
   3  result.log.Thu
   4  result.log.??
   5  result.log.??
   6  result.log.??

こうなると普通にファイル名を指定して操作することができません。

   1  $ wc -l 'result.log.??'
   2  wc: result.log.??: No such file or directory

この場合はlsの出力結果をnkfで変換して正しいファイル名を確認します。

   1  $ ls result.log.* | nkf -e
   2  result.log.Fri
   3  result.log.Thu
   4  result.log.金
   5  result.log.土
   6  result.log.木

確認したファイル名を指定することでファイルが操作できます。

   1  $ wc -l result.log.金
   2  409 result.log.金

posted by Png akanuma on Fri 8 Jun 2012 at 09:12 with 1 comment

Comments:

Face yoku0825 almost 12 years ago.

nkfの方が使いやすいですが、glibcに含まれているiconvの方が 確実にどの環境にも入っていると思うのですよー。

or Preview
Social Bookmarks
  • Delicious
  • B_entry2130
  • Clip_16_12_w
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ