Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikibooksThe Free Textbook Project
Search

C Shell Scripting/snippets

From Wikibooks, open books for an open world
<C Shell Scripting

String manipulation

[edit |edit source]

How to lower and upper case a string using thetr command.

#!/bin/csh -fsetDS=\$aliaslowertr'A-Z''a-z'aliasuppertr'a-z''A-Z'aliasrot13"tr 'A-M N-Z a-m n-z' 'N-Z A-M n-z a-m'"aliasltrim"sed 's/^[ \t\n\r]*//'"aliasrtrim"sed 's/[ \t\n\r]*$DS//'"aliastrim"sed 's/^[ \t\n\r]*//;s/[ \t\r\n]*$DS//'"echoHello|lowerechoHello|upperechoHello|rot13echo"  yabba dabba do"|rtrimsetHELLO=" hELLO "if(`echo$HELLO|lower|trim`=="hello")thenecho"match"endif
Retrieved from "https://en.wikibooks.org/w/index.php?title=C_Shell_Scripting/snippets&oldid=3678171"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp