Solved

Exclude certain lines for the matching words in the output file

Posted on 2011-09-15
3
412 Views
Last Modified: 2012-08-13
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
Comment
Question by:upanwar
3 Comments
 
LVL 7

Assisted Solution

by:jackiechen858
jackiechen858 earned 250 total points
ID: 36543860
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
 
LVL 2

Accepted Solution

by:
cyclechip earned 250 total points
ID: 36548692
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
 
LVL 12

Author Closing Comment

by:upanwar
ID: 36548904
Thanks Guys.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question