User Tools

Site Tools


awk:display_lines_that_contain_a_specific_string

AWK - Display lines that contain a specific string

awk '/the_string/' file.txt

Example

Assuming a file, test.txt, exists with the following contents:

10   Peter     Terence   Roux        45
11   Virginia  Genevieve  Roux        45
12   Felix     Devon     Roux         5
13   David     Bruce     Stevenson   48
14   Bob       James     Smith       16
48   Adam      Winter    Ridley      23

Running

awk '/Roux/' test.txt

returns:

10   Peter     Terence   Roux        45
11   Virginia  Genevieve  Roux       45
12   Felix     Devon     Roux         5
awk/display_lines_that_contain_a_specific_string.txt · Last modified: 2021/01/06 17:11 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki