Linux/Unixtr, variable, operation, and terminal feature settings
Last Update:2014-05-22
Source: Internet
Author: User
For Linux/Unixtr, variables, operations, and terminal feature settings, use the-s option of tr to remove repeated characters: *andthecowwwwwwswenthomeeeordidtheyyyyyyyy... for Linux/Unix tr, variables, operations, and terminal feature settings, use the-s option of tr to remove repeated characters: www.2cto.com [oracle @ localhost tr. folder] $ cat oops.txt And the cowwwwwws went homeeeeeOr did theyyyyyyyyyyy [oracle @ localhost tr. folder] $ tr-s "[a-z]" <oops.txt And the cows went homeOr did they delete empty rows: w Ww.2cto.com [oracle @ localhost tr. folder] $ cat oops.txt And the cowwwwwws went homeeeee Or did theyyyyyyyyyyy fas ods css [oracle @ localhost tr. folder] $ tr-s "[\ 012]" <oops.txt And the cowwwwwws went homeeeeeeeor did theyyyyyyyyyyyfas ods css conversion case: [oracle @ localhost tr. folder] $ echo "hello today is a Fine DAY" | tr "[a-z]" "[A-Z]" hello today is a fine day delete number: [oracle @ localhost tr. folder] $ cat oo Ps.txt And the cowwwwwws went homeeeee233123asadfas123ffff Or did theyyyyyyyyyyyyy 12 fas ods css [oracle @ localhost tr. folder] $ tr-cs "[a-z] [A-Z]" [\ 012 *] "<oops.txt hosts [oracle @ localhost etc] $ echo" 'Who | wc- l 'users are on today "2 users are on today to view the current terminal features: [oracle @ localhost testDir] $ stty-aspeed 38400 baud; rows 44; columns 167; line = 0; intr = ^ C; quit = ^ \; erase = ^ ?; Kill = ^ U; eof = ^ D; eol = ; Eol2 = ; Swtch = ; Start = ^ Q; stop = ^ S; susp = ^ Z; rprnt = ^ R; werase = ^ W; lnext = ^ V; flush = ^ O; min = 1; time = 0; -parenb-parodd cs8-hupcl-cstopb cread-clocal-extract-encoding-brkint-ignpar-parmrk-inpck-istrip-inlcr-igncr icrnl ixon-ixoff-upload-ixany-imaxbel -configure-rule onlcr-onocr-onlret-ofill-ofdel nl0 cr0 tab0 bs0 vt0 unzip icanon iexten echo echoe echok-echonl-noflsh-xcase-tostop-choose echoctl echoke styy xxx "xxx" sets the default value of the variable: [oracle @ localhost testDir] $ day = bad [oracle @ localhost testDir] $ echo "today is a $ {day: -fine} day "today is a bad day [oracle @ localhost testDir] $ unset day [oracle @ localhost testDir] $ echo" today is a $ {day: -fine} day "today is a fine day to set read-only variables: [oracle @ localhost testDir] $ readonlydeclare-ar BASH_VERSINFO = '([0] = "3" [1] = "1" [2] = "17" [3] =" 1 "[4] =" release "[5] =" i686-redhat-linux-gnu ") 'destare-ir EUID = "501" declare-ir PPID = "19022" declare-r SHELLOPTS = "braceexpand: emacs: hashall: histexpand: history: interactive-comments: monitor "declare-ir UID =" 501 "[oracle @ localhost testDir] $ weather = fine [oracle @ localhost testDir] $ readonly weather [oracle @ localhost testDir] $ echo $ {weather} fine [oracle @ localhost testDir] $ weather = fine2-bash: weather: readonly variable: [oracle @ localhost testDir] $ console = tty1; export console [oracle @ localhost testDir] $ echo $ console tty1 display all environment variables: env sets the terminal type: [oracle @ localhost testDir] $ TERM = linux; export TERM [oracle @ localhost testDir] $ echo $ operations in TERMlinux shell: [oracle @ localhost testDir] $ var = 'date + % Y % m % d' [oracle @ localhost testDir] $ let "var2 = $ var + 1" [oracle @ localhost testDir] $ echo $ var2 20130304 [oracle @ localhost testDir] $ echo $(var2 = $ var + 3 )) 20130306 [oracle @ localhost testDir] $ echo var2 = $ [$ var + 3] var2 = 20130306 [oracle @ localhost testDir] $ let "var ++" [oracle @ localhost testDir] $ echo $ var20130304 [oracle @ localhost testDir] $ echo $ [var + 1] 20130305