Hi guys,
I'm a complete noob to awk and have a question which I'd really appreciate help on
I have to search a file for a list of specific words which are separated by a semicolon ( word1;word2;word3;.... ) and is achieved by:
This does return all the places in the file where the words are present and works great. However the next step is to filter through these results as some of the results returned are actually allowed and so I do not want to return them from the search.
To do this, I have a another set of "allowed words" separated by a semi-colon but am having trouble achieving it and am stuck for ideas.
Any ideas?
I'm using nawk within a ksh script to achieve this, hope this is clear enough...
I'm a complete noob to awk and have a question which I'd really appreciate help on
I have to search a file for a list of specific words which are separated by a semicolon ( word1;word2;word3;.... ) and is achieved by:
Code:
n = split ( list, a, ";" )
for ( i = 1; i <= n; i++ )
if (index( $0,a[ i ]) != 0)
{
[i]do something if found[/i]
}
This does return all the places in the file where the words are present and works great. However the next step is to filter through these results as some of the results returned are actually allowed and so I do not want to return them from the search.
To do this, I have a another set of "allowed words" separated by a semi-colon but am having trouble achieving it and am stuck for ideas.
Any ideas?
I'm using nawk within a ksh script to achieve this, hope this is clear enough...