Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Check for entry of specific pattern Post 302836189 by RudiC on Tuesday 23rd of July 2013 05:33:17 PM
Old 07-23-2013
Doesn't save much typing effort, but might be easier to read: ...[[:xdigit:]]{2}...
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Not able to check for entry within file

Hi I am basically checking if a required entry exists within a file. In the code below I am fetching all directories of the format rel1, rela, rel3..etc..The same entries also exist in the sample log file. I want to check if entry in file1 exists within file2 but it is failing. Can you please... (4 Replies)
Discussion started by: swasid
4 Replies

2. UNIX for Dummies Questions & Answers

How to Detect Specific Pattern and Print the Specific String after It?

I'm still beginner and maybe someone can help me. I have this input: the great warrior a, b, c and what i want to know is, with awk, how can i detect the string with 'warrior' string on it and print the a, b, and c seperately, become like this : Warrior Type a b c Im still very... (3 Replies)
Discussion started by: radynaraya
3 Replies

3. Shell Programming and Scripting

Notification of the modification of a specific entry in a file

I need to get notification via email when the line containing a pattern is changed in a file. Not during the time any changes to file occurs. Ie if we reset a user password say example, demouser the hash in the line containing the word demouser in the file /etc/group changes. So when this change... (1 Reply)
Discussion started by: anil510
1 Replies

4. Shell Programming and Scripting

how to change specific value for a entry in the file

Hello All, can someone please suggest me a one line command to change a specific value that is associated to an entry in the file. for example #more schedulefile quartz.job.manual.bonus.schedule=0 0 9 ? * * # it should be changed to #more schedulefile... (5 Replies)
Discussion started by: bobby320
5 Replies

5. Shell Programming and Scripting

Replacing specific entry using sed

Hi guys, I'm new to bash programming, so please pardon me. I'm trying to replace an entry's text in Books.txt This code works perfectly: sed -i "s/$BookTitle/$NewBookTitle/g" Books.txt But problem is, if there are double entries, it will also replace that entry. For example: ... (12 Replies)
Discussion started by: todaealas
12 Replies

6. Shell Programming and Scripting

Extract specific line in an html file starting and ending with specific pattern to a text file

Hi This is my first post and I'm just a beginner. So please be nice to me. I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file? I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies

7. Programming

PYTHON COPY Contents of file1 into a specific entry in file2

file1 cat dog fish file2 This is a bunch of lines <!-- INSERT ANIMALS HERE --> horse cheetah post results file2 This is a bunch of lines <!-- INSERT ANIMALS HERE --> cat dog fish horse (1 Reply)
Discussion started by: TY718
1 Replies

8. Shell Programming and Scripting

Check first specific string after a pattern

Hi, I've a file with content as below first_block_list{ a:5 b:3 c:8 } new_store_list( a:1000 b:200 c:3343 ) first_item_list{ a:10 b:20 c:30 } second_item_list{ (1 Reply)
Discussion started by: ratheeshp
1 Replies

9. Shell Programming and Scripting

Extract whole word preceding a specific character pattern with first occurence of the pattern

Hello. Here is a file contents : declare -Ax NEW_FORCE_IGNORE_ARRAY=(="§" ="§" ="§" ="§" ="§" .................. ="§"Here is a pattern =I want to extract 'NEW_FORCE_IGNORE_ARRAY' which is the whole word before the first occurrence of pattern '=' Is there a better solution than mine :... (3 Replies)
Discussion started by: jcdole
3 Replies
NestedGroups(3pm)					User Contributed Perl Documentation					 NestedGroups(3pm)

NAME
Set::NestedGroups - grouped data eg ACL's, city/state/country etc SYNOPSIS
use Set::NestedGroups; $nested = new Set::NestedGroups; $nested->add('user','group'); $nested->add('group','parentgroup'); do_something() if($nested->member('user','parentgroup')); DESCRIPTION
Set::NestedGroups gives an implementation of nested groups, access control lists (ACLs) would be one example of nested groups. For example, if Joe is a Manager, and Managers have access to payroll, you can create an ACL which implements these rules, then ask the ACL if Joe has access to payroll. Another example, you may wish to track which city, state and country people are in, by adding people to cities, cities to states, and states to countries. CONSTRUTORS
new() creates a new Set::NestedGroups object. new( fh ) creates a new Set::NestedGroups object, the object will be initialized using data read from this handle. For details on the format, see the save() method new( $sth ) creates a new Set::NestedGroups object, the object will be initialized using data read using this this DBI statement handle. For details on the format, see the save() method METHODS
add ( $member, $group) adds a member to a group. The group will be created if it doesn't already exist. remove ( $member, $group ) removes a member from a group. If this was the last member in this group, then the group will be deleted. If the member was only in this group, then the member will be deleted. save(FILEHANDLE) Outputs the object to the given filehandle, which must be already open in write mode. The format is compatable with the format used by CGI, and can be used with new to initialize a new object; Returns true if successfully wrote the data, or false if something went wrong (usually that meant that the handle wasn't already open in write mode). save($sth) Saves the object to a DBI database. This can be used with new to initialize a new object. The $sth should be expecting 2 values, in this fashion: $sth = $dbh->prepare('insert into acl values (?,?)') $acl->save($dbh); $sth->finish(); $sth = $dbh->prepare('select * from acl'); $newacl=new ACL($sth); Returns true if successfully wrote the data, or false if something went wrong. member ( $member, $group ) Returns true if $member is a member of $group. member ( $member ) returns true if $member exists in any group. group ( $group ) returns true if $group exists groups ( $member, %options ) Returns the groups that $member belongs to. Options are explained below. members ( $group , %options ) Returns the members of $group. Keep on reading for the options list(%options) Returns a Set::NestedGroups::Member object that will output an list of the members & groups. This could be considered a calling of groups() on each member, except this is more efficent. The object can be used as follows. $list=$nested->list(); for(my $i=0;$i<$list->rows();$i++){ my ($member,$group)=$list->next(); print "$member=$group "; } options By default, the above methods give every valid combination. However you might not always want that. Therefore there are options which can prevent return of certain values. All of these examples presume that 'joe' is a member of 'managers', and 'managers' is a member of payroll, and that you are using only one of these options. You can use all 3, but that gets complicated to explain. -norecurse=>1 No Recursion is performed, method would ignore payroll, and return only managers. -nomiddles=>1 Doesn't returns groups 'in the middle', method would ignore mangers, and return only payroll. -nogroups=>1 Doesn't return members that are groups. This only applies to the list() method, in which case it acts like nomiddles, except on the member instead of the group. list would ignore managers and return joe => managers , joe => payroll. This sounds a lot more confusing than it actually is, once you try it once or twice you'll get the idea. AUTHOR
Alan R. Barclay, gorilla@elaine.drink.com SEE ALSO
perl(1), CGI, DBI. perl v5.8.8 2008-03-12 NestedGroups(3pm)
All times are GMT -4. The time now is 11:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy