Sponsored Content
Full Discussion: Selecting a range of Lines
Top Forums Shell Programming and Scripting Selecting a range of Lines Post 302437190 by beinthemiddle on Wednesday 14th of July 2010 09:14:57 AM
Old 07-14-2010
@anchal_khare
It was just an example code which simulates my scenario. Thanks for the suggestion.

@dr.house
My system do not support grep with keyword -A. Unfortunately I cannot use it. But if I need to , I will get a GNU grep and will surely use ur suggestion. Thanks for your suggestion.

@rujuraha
Your suggestion worked fine for me. Lots Of Smiles :-) and Thank you.


@Franklin52
I am in the process of learning awk. Thanks for your suggestion. I will use it.

@alister,
I am a bit hesitant to use sed. I dont know exactly. Anyway thanks for ur suggestions.

Thanks All for those replies... I am able to go to the next level of my project. unix.com always rocks. Keep up the good work.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

selecting only few lines from many based on a common pattern

Hi, I have a file having some thousand records with the following sort of lines: Error: Failed to get order data Order: PO-BBBTGZE Error: No CLI Error: Failed to get order data Order: PO-SBDJUZA Order: PO-XBBIDEN Error: No CLI Error: Failed to get order data Order: PO-BBDJUTQ Order:... (2 Replies)
Discussion started by: damansingh
2 Replies

2. Shell Programming and Scripting

Selecting files between a user inputed date range

Hi all! I'm working on a KSH script to select files between a user inputed date range (stored in a variable) and then move them and unzip them. I'm stuck at how to get the files between the user inputed date range selected. Any help would be greatly appreciated! The files are as such: ... (6 Replies)
Discussion started by: kelldan
6 Replies

3. Shell Programming and Scripting

Selecting Lines on text file

Hi All, I am creating a script that sends log data from text files to a Database and I will like to read sugestions, as I think that there might be better ways to achive this than with my shell script; maybe perl or I don't know, but I will like to read some sugestions. The log is from... (10 Replies)
Discussion started by: oconmx
10 Replies

4. Shell Programming and Scripting

about selecting lines

Hello , i got text file like that' C:\Users\Public\Pictures\Sample Pictures\aa.jpg C:\Users\Public\Pictures\Sample Pictures\thumb.jpg C:\Users\Public\Pictures\vv\cc.jpg C:\Users\Public\Pictures\Sample Pictures\ee.jpg C:\Users\Public\aa\Sample Pictures\cvswsr.jpg... (1 Reply)
Discussion started by: davidkhan
1 Replies

5. Shell Programming and Scripting

Selecting lines with sed

Hi all, I have a file with special characters like this file1 691775025 ýÄqJ8^Z^Y{ 2004-08-23E P 100.00 45585025 0527541139295037342008-07-25OEP 100.00 6983025 ýB<9D>x<^F^Xb 2004-11-16SPP 100.00 I need a sed command to print the lines which don't have special characters.ie., only line 2... (9 Replies)
Discussion started by: allinshell
9 Replies

6. Shell Programming and Scripting

Selecting lines of a file

Say I wanted to select the 5th line of a file without knowing the context of the file. Would I use grep and pipe it into wc or is there a more simple way of doing this? (3 Replies)
Discussion started by: puttster
3 Replies

7. Shell Programming and Scripting

selecting lines using awk

I have a file which contains five hundred thousand lines (500,000). I want to select lines of every 1000 lines from that file using AWK. I can think something like this in bash as below: for lines in {0..500000..1000} do ........ ........ done But I want to use AWK. I do not know how to... (4 Replies)
Discussion started by: vjramana
4 Replies

8. Shell Programming and Scripting

selecting and deleting specific lines with condition

I have a set of data as below: The first field, $1 represent "|". The $3 (3rd field) and $6 (6th field) in my data file represent "number-molecule" which has arrangement as below: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ... (9 Replies)
Discussion started by: vjramana
9 Replies

9. UNIX for Dummies Questions & Answers

Selecting highest value within a range

Within millions of lines of data, there are perhaps 20 "spikes" that are very narrow. I want only the highest value from each spike within a range of 10 rows. Possible? My data looks like this, 8 columns of integers, millions of rows. There are clear spikes when you graph columns. ... (6 Replies)
Discussion started by: markymarkg123
6 Replies

10. Shell Programming and Scripting

Selecting lines having same values for first two columns

Hello to all. This is first post. Kindly excuse me if I do not adhere to any rules and regulations of this forum. I have a file containing some rows with three columns each per row(separeted by a space). There are certain rows for which first two columns have same value but the value in... (6 Replies)
Discussion started by: manojmalhotra13
6 Replies
LOGPROF(8)							     AppArmor								LOGPROF(8)

NAME
aa-logprof - utility program for managing AppArmor security profiles SYNOPSIS
aa-logprof [-d /path/to/profiles] [-f /path/to/logfile] [-m <mark in logfile>] OPTIONS
-d --dir /path/to/profiles The path to where the AppArmor security profiles are stored -f --file /path/to/logfile The path to the location of the logfile that contains AppArmor security events. -m --logmark "mark" aa-logprof will ignore all events in the system log before the specified mark is seen. If the mark contains spaces, it must be surrounded with quotes to work correctly. DESCRIPTION
aa-logprof is an interactive tool used to review AppArmor's complain mode output and generate new entries for AppArmor security profiles. Running aa-logprof will scan the log file and if there are new AppArmor events that are not covered by the existing profile set, the user will be prompted with suggested modifications to augment the profile. When aa-logprof exits profile changes are saved to disk. If AppArmor is running, the updated profiles are reloaded and if any processes that generated AppArmor events are still running in the null-complain-profile, those processes are set to run under their proper profiles. Responding to AppArmor Events aa-logprof will generate a list of suggested profile changes that the user can choose from, or they can create their own, to modifiy the permission set of the profile so that the generated access violation will not re-occur. The user is then presented with info about the access including profile, path, old mode if there was a previous entry in the profile for this path, new mode, the suggestion list, and given these options: (A)llow, (D)eny, (N)ew, (G)lob last piece, (Q)uit If the AppArmor profile was in complain mode when the event was generated, the default for this option is (A)llow, otherwise, it's (D)eny. The suggestion list is presented as a numbered list with includes at the top, the literal path in the middle, and the suggested globs at the bottom. If any globs are being suggested, the shortest glob is the selected option, otherwise, the literal path is selected. Picking includes from the list must be done manually. Hitting a numbered key will change the selected option to the corresponding numbered entry in the list. If the user selects (N)ew, they'll be prompted to enter their own globbed entry to match the path. If the user-entered glob does not match the path for this event, they'll be informed and have the option to fix it. If the user selects (G)lob last piece then, taking the currently selected option, aa-logprof will remove the last path element and replace it with /*. If the last path element already was /*, aa-logprof will go up a directory level and replace it with /**. This new globbed entry is then added to the suggestion list and marked as the selected option. So /usr/share/themes/foo/bar/baz.gif can be turned into /usr/share/themes/** by hitting "g" three times. If the user selects (A)llow, aa-logprof will take the current selection and add it to the profile, deleting other entries in the profile that are matched by the new entry. Adding r access to /usr/share/themes/** would delete an entry for r access to /usr/share/themes/foo/*.gif if it exists in the profile. If (Q)uit is selected at this point, aa-logprof will ignore all new pending capability and path accesses. After all of the path accesses have been handled, logrof will write all updated profiles to the disk and reload them if AppArmor is running. New Process (Execution) Events If there are unhandled x accesses generated by the execve(2) of a new process, aa-logprof will display the parent profile and the target program that's being executed and prompt the user to select and execute modifier. These modifiers will allow a choice for the target to: have it's own profile (px), inherit the parent's profile (ix), run unconstrained (ux), or deny access for the target. See apparmor.d(5) for details. If there is a corresponding entry for the target in the qualifiers section of /etc/apparmor/logprof.conf, the presented list will contain only the allowed modes. The default option for this question is selected using this logic-- # if px mode is allowed and profile exists for the target # px is default. # else if ix mode is allowed # ix is default # else # deny is default aa-logprof will never suggest "ux" as the default. ChangeHat Events If unknown change_hat(2) events are found, the user is prompted to add a new hat, if the events should go into the default hat for this profile based on the corresponding entry in the defaulthat section of logprof.conf, or if the following events that run under that hat should be denied altogether. Capability Events If there are capability accesses, the user is shown each capability access and asked if the capability should be allowed, denied, or if the user wants to quit. See capability(7) for details. BUGS
None. Please report any you find to bugzilla at <http://bugzilla.novell.com>. SEE ALSO
klogd(8), auditd(8), apparmor(7), apparmor.d(5), change_hat(2), logprof.conf(5), aa-genprof(1), aa-complain(1), aa-enforce(1), and <http://forge.novell.com/modules/xfmod/project/?apparmor>. NOVELL
/SUSE 2008-06-11 LOGPROF(8)
All times are GMT -4. The time now is 11:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy