User Tools

Site Tools


awk:display_lines_that_don_t_contain_a_specific_string

AWK - Display lines that don't 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:

13   David     Bruce     Stevenson   48
14   Bob       James     Smith       16
48   Adam      Winter    Ridley      23
awk/display_lines_that_don_t_contain_a_specific_string.txt · Last modified: 2021/01/06 17:12 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki