首页 > 科技 > tr

tr

2006年3月8日 16点01分 发表评论 阅读评论

Tr is used to delete controll characters and substance characters from standard input file.There are two strings, one indicates query conditions, and anther is used to translate between characters. When using tr, the first string is imaged to the second string, and then begin to translate.
syntax: tr -c -d -s [*string1_to_translate_from*] [string2_to_] file
-c : use the other character set except for itself in ASCII to substance the original.
-d : delete all the character existing in the first string
-s : delete all the duplicate character, and only keep the unique character.
1. delete duplicate lines:
# vi oops.txt
Baaarcelona vvs Chellseaa
# tr -s “[a-z]” oops.txt
Barcelona vs Chelsea
2. delete null lines.
# tr -s “[

分类: 科技 标签:
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.
您必须在 登录 后才能发布评论.