Added Lab7

This commit is contained in:
Theodotos Andreou 2018-06-30 12:17:52 +03:00
부모 26ed50b695
커밋 ccf021823e
2개의 변경된 파일102326개의 추가작업 그리고 0개의 파일을 삭제

102305
Lab7/matches.txt Normal file

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다. Load Diff

21
Lab7/regex.examples Normal file
파일 보기

@ -0,0 +1,21 @@
grep a matches.txt # find lines containing 'a'
grep ab matches.txt # find lines containing 'abc'
grep '^ab$' matches.txt # find lines starting with 'abc'
grep "[hat]" matches.txt # find lines containing h, a or t
grep -E "[abc]{3,4}" matches.txt # find strings with 3 or 4 successive combination of a, b or c
grep -E -n -o "[abc]{3,4}" matches.txt # show line numbers and matches only
ip addr | egrep "([0-9]{1,3}\.){3}[0-9]{1,3}" # find IP addresses
ip addr | egrep "([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}" # find MAC Addresses
grep "[[:punct:]]" matches.txt # find punctuation
grep "[linux]{3,5}" regex.examples # find l,i,n,u, or x in a pattern between 3 to 5 characters
egrep "[linux]{3,5}" regex.examples # did it work now?
grep '[[:alpha:]]' regex.examples # find lettes
fgrep '[[:alpha:]]' regex.examples # find the single quote enclosed string explicitly
grep "[[:blank:]]" matches.txt # find space or tab
grep "[[:space:]]" matches.txt # find all whitespace
grep "[[:blank:]]$" matches.txt # find space or tab at the line’s end
grep "[[:space:]]$" matches.txt # find whitespace at the line’s end
grep -i uuid /etc/fstab # find the 'uuid' string
sed -e 's/UUID/uuid' /etc/fstab | grep uuid # case sensitive
sed 's/UUID/UUID UUID/' /etc/fstab | sed 's/UUID/uuid/' # replace only the first match of UUID
sed 's/UUID/UUID UUID/' /etc/fstab | sed 's/UUID/uuid/g' # replace all matches of UUID