LoginSignup

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 3 years have passed since last update.

tr

Last updated at Posted at 2020-05-04

できること

  • 文字列内の文字を置換したり削除したりする

基本構文

$ tr '置換対象' '置換文字列'

よく使う構文

小文字を大文字に置換

$ tr '[a-z]' '[A-Z]'
$ tr '[:lower:]' '[:upper:]'

特定の文字を削除

$ tr -d -c '[a-z]'

よく使うオプション

削除

$ tr -d

指定したもの以外

$ tr -c [a-z]

その他

  • 特定の文字を操作する以上の複雑な処理をしたい場合はsedなどを使用する。
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up