1 頁 (共 1 頁)

LPIC-1 Study Guide SYBEX

發表於 : 2015-04-25 15:38:14
yehlu
https://red.anillosur.net/file/download/255586

代碼: 選擇全部

echo 'abcccccc' | grep -E '^abc{3,5}'
echo 'abcccccc' | grep  '^abc\{3,5\}'
echo  '192.168.1.1' | grep -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';

Re: LPIC-1 Study Guide SYBEX

發表於 : 2015-04-25 15:51:40
yehlu
IP Address Regular Expression Pattern

^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.
([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$
Description

^ #start of the line
( # start of group #1
[01]?\\d\\d? # Can be one or two digits. If three digits appear, it must start either 0 or 1
# e.g ([0-9], [0-9][0-9],[0-1][0-9][0-9])
| # ...or
2[0-4]\\d # start with 2, follow by 0-4 and end with any digit (2[0-4][0-9])
| # ...or
25[0-5] # start with 2, follow by 5 and ends with 0-5 (25[0-5])
) # end of group #2
\. # follow by a dot "."
.... # repeat with 3 times (3x)
$ #end of the line
Whole combination means, digit from 0 to 255 and follow by a dot “.”, repeat 4 time and ending with no dot “.” Valid IP address format is “0-255.0-255.0-255.0-255″.

Re: LPIC-1 Study Guide SYBEX

發表於 : 2015-04-25 15:56:59
yehlu
台灣POSTCODE 3 或 5 碼數字

代碼: 選擇全部

echo '1234' | grep -E '\<[0-9]{3}([0-9]{2}$)\>'

Re: LPIC-1 Study Guide SYBEX

發表於 : 2015-04-25 16:38:34
yehlu
找出最後一天的日期

代碼: 選擇全部

 cal | xargs | awk '{print $NF}'