Sponsored Content
Top Forums Shell Programming and Scripting Returning only part of a line when grepping Post 302410275 by riott on Monday 5th of April 2010 01:48:30 PM
Old 04-05-2010
Sorry.. after receiving the replies, I realized that I left out a main part. lol.

The sid's are stored in a file where each one is listed one per line, like so:

154987
198786
387984
978165
...

I'm grepping the snort rules file through all of the rules therein for the matching sid's, and all I want is the message. Sorry for not being more clear. So far I have:

grep -f sids /data/snort/snort.rules

and was wondering what to pipe it into to return only the message. I can see that it will probably be sed, but I'm not good with regular expressions. Sorry again for not being more clear on my problem, and thank you guys for already trying to help.

~Riott
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

grepping for something but excluding something else in the line

Ok heres the situation. I'm grepping for all running processes with the name system. but there are also processes running with the name systema. How do I just search for processes running just under the "system" user Thanks in advance (1 Reply)
Discussion started by: fusion99
1 Replies

2. Shell Programming and Scripting

grepping a part of filenames

Hi , I have a list of files in a directory and filename format is as follows: PQ223390 PQ876912 PQ768901 PQ398140 and so on I want to grep the first four digits of all the files after PQ, into a file. Ex: 2233 8769 6890 3981 and so on Can anyone tell me the command? thankx jazz (11 Replies)
Discussion started by: jazz
11 Replies

3. Shell Programming and Scripting

Grepping 1 line above and below pattern

I have a pattern:: xldn3176bap>arj SOCRATES_MAIN_LNX | grep " FA " 10/04/2007 21:01 10/04/2007 21:01 FA 1776752/1 1 I want the line above this line and the line below it too. Can anyone tell me how it can be done? - iAm4Free (4 Replies)
Discussion started by: iAm4Free
4 Replies

4. Shell Programming and Scripting

reading line by line and grepping

I've got a file which I am reading line by line (using read line) into a variable. I then want to do a grep on that line to check for something. I've tried a number of methods none of which seem to work. I thought I had it with the code below but for some reason it doesn't like it and comes... (4 Replies)
Discussion started by: QueryMaster
4 Replies

5. Shell Programming and Scripting

BASH: Grepping/sedding/etc out part of a file... (from one word to 'blank' line)

I have a file that lists data about a system. It has a part that can look like: the errors I'm looking for with other errors: Alerts Password Incorrect Login Error Another Error Another Error 2 Other Info or, just the errors I need to parse for: Alerts Password Incorrect ... (9 Replies)
Discussion started by: elinenbe
9 Replies

6. UNIX for Dummies Questions & Answers

Help with grepping and line number

I need help with extracting data from a large file ~900mb. Below is how the data looks like, line number value 1001 10000 ... ... 5001 50000 6001 60000 ... ... 10001 100000 ... ... 100001 ... (3 Replies)
Discussion started by: shabs1985
3 Replies

7. UNIX for Dummies Questions & Answers

Grepping nth line number

How do you grep every nth line number from a file? (2 Replies)
Discussion started by: shabs1985
2 Replies

8. Shell Programming and Scripting

Grepping file and returning passed variable if the value does not exist in file at all.

I have a list of fields that I want to check a file for, returning that field if it not found at all in the file. Is there a way to do a grep -lc and return the passed variable too rather then just the count? I am doing some crappy work-around now but I was not sure how to regrep this for :0 so... (3 Replies)
Discussion started by: personalt
3 Replies

9. Shell Programming and Scripting

[Solved] Printing a part of the last line of the specific part of a file

Hi, I have 80 large files, from which I want to get a specific value to run a Bash script. Firstly, I want to get the part of a file which contains this: Name =A xxxxxx yyyyyy zzzzzz aaaaaa bbbbbb Value = 57 This is necessary because in a file there are written more lines which... (6 Replies)
Discussion started by: wenclu
6 Replies

10. Shell Programming and Scripting

Finding pattern in a text file and returning a part of the word

Dear All, assume that we have a text file or a folder of files, I want to find this pattern followers*.csv in the text file , and get * as the output. There are different matches and * means every character. Thank you in advance. Best, David (1 Reply)
Discussion started by: davidfreed
1 Replies
setrules(1M)															      setrules(1M)

NAME
setrules - set compartment rules SYNOPSIS
DESCRIPTION
takes the current rules files on the system and puts them into effect. Prior to using this command, changes in the rules files have no effect on the system. This command can only be used when compartmentalization is enabled (see cmpt_tune(1M)). Options recognizes the following option: Preview the rules. This option parses the rules files, checking for syntax and semantic errors, but makes no changes to the system. Security Restrictions The user invoking this command must have one of the following authorizations: A user with authorization can invoke this command from any compartment, while a user with authorization can invoke this command from only those compartments that have read and write access to the directory heirarchy. See authadm(1M)). Notes If a compartment is tagged for automatic discovery of rules using the keyword subsequent runs of command does NOT clear the rules that are already discovered. This means the rules applied are inconsistent with the rules currently in the directory. To make them consistent, first run "", and then run where, compartment_name is the name of the compartment which is under for discovery mode and file.rules is the rules file containing the rules for this compartment. RETURN VALUE
returns the following values: Successful completion. The rules are displayed. An error occurred. An error can be caused by the following: o An invalid option. o The user does not having permissions to perform the operation. o A syntax or semantic error in a rule file. o Other system errors (for example, insufficient system resources). EXAMPLES
Example 1: Execute to push the configured rules: Example 2: Execute to push syntactically incorrectly configured rules: Sample Output: Error: "/etc/cmpt/11.cmpt.1.rules", line 10 # Unexpected token 'web' or rule terminated prematurely setrules: Exiting due to parse errors Example 3: Execute setrules to find any syntactically or semantically incorrectly configured rules: Sample Output: Error: "/etc/cmpt/iface.rules", line 10 # Undefined compartment "ooutside". Error: "/etc/cmpt/iface.rules", line 14 # Undefined compartment "cgi". SEE ALSO
authadm(1M), cmpt_tune(1M), getrules(1M), compartments(4), compartments(5). setrules(1M)
All times are GMT -4. The time now is 02:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy