Monthly Archives: April 2012

How does bracket expression and negation [^ ] work with grep ?

commandline session

$ 4.2.20 19 519---> grep '[^b  ]sort' worked
Heapsort
Quicksort
 Timsort
$ 4.2.20 20 520---> cat worked
Bubble sort
Selection sort
Insertion sort
Shell sort
Comb sort
Merge sort
Heapsort
Quicksort
Counting sort
 Bucket sort
 Radix sort
 Distribution sort
 Timsort
$ 4.2.20 21 521--->

grep . bracket expressions [ ]

commandline session

$ 4.2.20 14 514---> grep '[bg]zip' worked
$ 4.2.20 15 515---> grep '[bg]sort' worked
$ 4.2.20 16 516---> grep '[b ]sort' worked
Bubble sort
Selection sort
Insertion sort
Shell sort
Comb sort
Merge sort
Counting sort
 Bucket sort
 Radix sort
 Distribution sort
$ 4.2.20 17 517---> grep '[b  ]sort' worked
Bubble sort
Selection sort
Insertion sort
Shell sort
Comb sort
Merge sort
Counting sort
 Bucket sort
 Radix sort
 Distribution sort
$ 4.2.20 18 518---> cat worked
Bubble sort
Selection sort
Insertion sort
Shell sort
Comb sort
Merge sort
Heapsort
Quicksort
Counting sort
 Bucket sort
 Radix sort
 Distribution sort
 Timsort
$ 4.2.20 19 519--->

tweak tool icon 0.00001

grep . regular expression _ anchors $ and ^ (meta characters)

commandline session

$ 4.2.20 29 530---> grep -h '^sort' worked
$ 4.2.20 30 531---> grep -h 'sort^' worked
$ 4.2.20 31 532---> grep -h 'sort$' worked
Bubble sort
Selection sort
Insertion sort
Shell sort
Comb sort
Merge sort
Heapsort
Quicksort
Counting sort
 Bucket sort
 Radix sort
 Distribution sort
 Timsort
$ 4.2.20 32 533---> grep -h '$sort' worked
$ 4.2.20 33 534--->

grep . dot meta character

commandline session

$ 4.2.20 37 537---> grep  rt  worked
Bubble sort
Selection sort
Insertion sort
Shell sort
Comb sort
Merge sort
Heapsort
Quicksort
Counting sort
 Bucket sort
 Radix sort
 Distribution sort
 Timsort
$ 4.2.20 38 538---> grep  p.rt  worked
$ 4.2.20 39 539---> grep  ..rt  worked
Bubble sort
Selection sort
Insertion sort
Shell sort
Comb sort
Merge sort
Heapsort
Quicksort
Counting sort
 Bucket sort
 Radix sort
 Distribution sort
 Timsort
$ 4.2.20 40 540---> grep  s.rt  worked
Bubble sort
Selection sort
Insertion sort
Shell sort
Comb sort
Merge sort
Heapsort
Quicksort
Counting sort
 Bucket sort
 Radix sort
 Distribution sort
 Timsort
$ 4.2.20 41 541--->

Loading...
X
Copyright © 2009,  2010,  2011,  2012,  2013,  2014     BeautifulWork Project    e-mail:  ahiliation@yahoo.co.in
BeautifulWork Project comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.