Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 421
  • Last Modified:

Exclude certain lines for the matching words in the output file

We are pulling a SST audit report. In few server we are running apache or nfs or samba service so we want to exclude line fro the services from output of SST report. It is different for different boxes.

Can I have a file in place with the name of allowed services to exclude the service from the output? Please suggest me how to achieve this and send me the logic how to write this.
0
upanwar
Asked:
upanwar
2 Solutions
 
jackiechen858Commented:
Not sure exactly what you want to do. I think you probably can use awk or grep to do the task. You need to have a original text file with all the services, then write a script to remove those services you don't want.
0
 
cyclechipCommented:
Type this on the command line:
man grep

Open in new window

...or type it into google. The results will include the following:
-f FILE: Obtain patterns from FILE, one per line.
-v: Invert the sense of matching, to select non-matching lines.
So putting them together, create your "excludeTheseWords.txt" file of words to exclude (with a word on each line), then use the following format:
grep -v -f excludeTheseWords.txt

Open in new window

0
 
upanwarAuthor Commented:
Thanks Guys.
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now