

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 289 Views
awk Tip - #5
A file named "persons", contains the following names:
smith
chandler
jones
baker
russel
davidson
edwards
franks
zachary
wilson
turk
lee
harris
$ awk '/chandler|baker/' persons
- ONLY the lines with the names "chandler" and "baker" will be displayed
$ awk '/turk|davidson|russel/' persons
- ONLY the lines with the names "turk", "davidson", and "russel" will be
displayed

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 268 Views
@Trevor valuable tip for learners especially the beginners who want to explore 'awk'.
in addition to that, here are some examples to extract more information from the same file with some matching patterns :
1. awk '/^s/' persons : aims to print the texts beginning with s.
2. awk '/a/' persons : aims to print the texts containing a.
3. awk '/n$/' persons : aims to print the texts which ends with n.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 95 Views
Useful...!
Thanks for sharing..!!


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 64 Views
Glad you found it useful!
I'm way behind in my series. Got a lot of catching up to do.