From what I can tell the whole string (ABCD|/p) is a literal.
Mmmmm... no.
The string 'ABCD|' is a literal, the rest '/p' is the end of regex ('/') and print command ('p'). So the first sed command
is an instruction to print only lines containing 'ABCD|'. There is some redundancy there; the following would do the same:
The second sed removes the beginning of line until ABCD| including. Note that matching here is greedy, so if you have multiple instances of ABCD| there, the pattern is gonna match the longest possible substring. E.g.:
The third one removes trailing '|ABCD'
i can only find the first occurance of a pattern how do i set it to loop untill all occurances have changed.
#! /usr/bin/perl
use POSIX;
open (DFH_FILE, "./dfh") or die "Can not read file ($!)";
foreach (<DFH_FILE>) {
if ($_ !~ /^#|^$/) {
chomp;
... (1 Reply)
Hi guys,
I have the following expression :
typeset EXBYTEC_CHK=`egrep ^"+${PNUM}" /bb/data/firmexbytes.dta`
can anybody please explain to me what
^"+${PNUM}"
stands for in egrep statement? Thanks -A (3 Replies)
Hi guys,
got a problem here with sed on the command line.
If i have a string as below:
online xx:wer:xcv: sdf:/asdf/http:https-asdfd
How can i match the pattern "http:" and replace the start of the string to the pattern with null?
I tried the following but it doesn't work:
... (3 Replies)
Hi,
I am writing a simple log parsing system and have a question on pattern matching.
It is simply grep -v -f patterns.re /var/log/all.log
Now, I have the following in my logs
Apr 16 07:33:17 ad-font-dc1 EvntSLog: AD-FONT-DC1/NTDS ISAM (700) - "NTDS (384) NTDSA: Online defragmentation... (5 Replies)
Hi guys,
I have a file in the following format:
4222 323K 323L D222
494 8134 A023 A024
49 812A 9871 9872
492 A961 A962 A963
491 0B77 0B78 0B79
495 0B7A 0B7B 0B7C
4949 WER9 444L 999O
I need to grep the line... (5 Replies)
Hi Guys,
I am trying to setup a check for the string using an "if" statement. The valid entry is only the one which contain Numbers and Capital Alpha-Numeric characters, for example: BA6F, BA6E, BB21 etc...
I am using the following "if" constract to check the input, but it fails allowing Small... (3 Replies)
Hi Guys
I am trying to check if the pattern "# sign followed by one or several tabs till the end of the line" exists in my file. I am using the following query:
$ cat myfile | nawk '{if(/^#\t*$/) print "T"}'
Unfortunately it does not return the desired output since I know for sure that the line... (4 Replies)
Hi guys
I have the following case statement in my script:
case $pn.$db in
*?.fcp?(db)) set f ${pn} cp ;;
*?.oxa?(oxa) ) set oxa $pn ;;
esac
Can somebody help me to understand how to interpret *?.fcp?(db)) or *?.oxa?(oxa) ?
I cannot figure out how in this case pattern maching... (5 Replies)
'Hi
I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match.
Which option is to be used to exclude the line containing the pattern?
sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
I need to check the condition of a variable before the script continues and it needs to match a specific pattern such as EPS-03-0 or PDF-02-1.
The first part is a 3 or 4 letter string followed by a hyphen, then a 01,02 or 03 followed by a hyphen then a 0 or a 1.
I know I could check for every... (4 Replies)
Discussion started by: stormcel
4 Replies
LEARN ABOUT OSX
mbr_check_service_membership
MBR_CHECK_MEMBERSHIP(3) BSD Library Functions Manual MBR_CHECK_MEMBERSHIP(3)NAME
mbr_check_membership, mbr_check_service_membership -- check whether a user is a member of a group or service ACL
SYNOPSIS
#include <membership.h>
int
mbr_check_membership(uuid_t user, uuid_t group, int *ismember);
int
mbr_check_service_membership(uuid_t user, const char *service, int *ismember);
DESCRIPTION
mbr_check_membership() tests if a given user is a member of a group (either direct or indirect via a nested group). ismember is set to 1 if
the user is a member or 0 if not a member of the group. mbr_check_service_membership() similarly tests if a given user is a member of a ser-
vice ACL group. Service ACLs are special groups defined with the prefix "com.apple.access_". The service is then prefixed (e.g., "afp"
would check "com.apple.access_afp"). There is a special group that grants accessto all services called "com.apple.access_all_services".
Users may belong to any number of groups. mbr_check_membership() should always be used to check group membership, rather than calling
getgroups(2) or getgrouplist(2). The setgroups(2) and getgroups(2) routines are limited to a fixed number of gids, and so may not include
all of a user's groups.
There are two special cases. If the two uuids are equal, then ismember is set to 1. If the group uuid is equal to the reserved "everyone"
uuid (ABCDEFAB-CDEF-ABCD-EFAB-CDEF0000000C), then ismember will be set to 1 for any valid user.
Group membership information is managed by opendirectoryd(8).
RETURN VALUES
mbr_check_membership() does not test whether group exists or not. Querying membership for a nonexistent group will result in ismember being
set to 0. The function returns 0 on success or one of the following error codes on failure:
[EIO] Communication with openditectoryd(8) failed.
[ENOENT] user can not be found.
mbr_check_service_membership() is identical to mbr_check_membership() except that ENOENT means no service ACL has been defined.
SEE ALSO odutil(1), setgroups(2), getgroups(2), mbr_uid_to_uuid(3), opendirectoryd(8)Mac OS X November 5, 2011 Mac OS X