Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AWK Beginner needs help in script

Status
Not open for further replies.
Jan 13, 2003
105
Hi out there,

trying to get one certain string out of a textfile and want to look if that string has another appearance in the same file and print it out. What I have so far is:

Code:
  grep -v ^# textfile | awk 'BEGIN {RS=""} /\/usr\/bin\/vi|more|less|find|awk|man/ { if ( $0 !~ /[nN][oO][eE][xX][eE][cC]/ || $0 ~ /![ \t]*[nN][oO][eE][xX][eE][cC]/)  { printf("%s:%s : noexec does not exist \n",$1,$2) ; }}'

From this finding ( especially $2 ) I want to find out another appearance. Do not know how to code that.

And yes, you assumed right, input file is /etc/sudoers ..


Thx for your help

mad



Advanced Interactive eXecutable
 

Your requirements are clear as mud.
Do you mean the times and/or lines where a certain string appears in a file?
[ponder]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top