11-08-2019
@Reduic : Please find the below explanation on my requirements for scenario-1.
Input parameter:
********************
Scenario-1:
STRING="user::r--,user::ourfrd:r--"
Data available in File:
**************************
# file: /local/Desktop/myfile
# owner: me
# group: mygroup
user::rwx
user:myfrd:rwx
user:hisfrd:r-x
group::r-x
group:mygroup:rwx
mask::rwx
other::r-x
Expected Results - Modified File data
**********************************************
For Scenario-1:
# file: /local/Desktop/myfile
# owner: me
# group: mygroup
user::r--
user:myfrd:rwx
user:hisfrd:r-x
user:ourfrd:r--
group::r-x
group:mygroup:rwx
mask::rwx
other::r-x
Note: In the above result, the string "user:ourfrd:r--" is added newly to the file since it is not available already in file. Only the partially matching strings to be replaced like how we have "user::rwx" exists in file and the first few characters "user::" is getting matched with new input parameter "user::r--". so "user::r--" needs to be updated in file. This is what im trying for, hope now my requirement is clear to you ..
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
My requisite is to search for the string "0108"(which is the year and has come in the wrong year format) in a particular column say 4th column in a tab delimited file and then replace it with 2008(the correct year format) in the same position where 0108 was found..The issue is the last... (15 Replies)
Discussion started by: ganesh_248
15 Replies
2. UNIX for Dummies Questions & Answers
Hi All,
My requisite is to search for the string "0108"(which is the year and has come in the wrong year format) in a particular column say 4th column in a tab delimited file and then replace it with 2008(the correct year format) in the same position where 0108 was found in the same file..The... (27 Replies)
Discussion started by: ganesh_248
27 Replies
3. Shell Programming and Scripting
Hello: I have another question. Please consider the following two sample, tab-delimited files:
File_1:
Abf1 YKL112w
Abf1 YAL054c
Abf1 YGL234w
Ace2 YKL150w
Ace2 YNL328c
Cup9 YDR441c
Cup9 YDR442w
Cup9 YEL040w
...
File 2:
...
ABF1 YKL112W
ACE2 YLR131C (9 Replies)
Discussion started by: gstuart
9 Replies
4. Shell Programming and Scripting
Search and Replace a string pattern with empty in an xml file in unix:
My xml file would be like this :
<Accounts><Name>Harish</Name><mobile>90844444444444445999 </mobile><TRIG>srcujim-1</TRIG></Accounts><Accounts><Name>Satish</Name><mobile>908999</mobile><TRIG>ettertrtt-1</TRIG></Accounts>
... (1 Reply)
Discussion started by: harish_s_ampeo
1 Replies
5. UNIX for Dummies Questions & Answers
Hi
I am looking for a particular string in a file.If the string exists, then I want to replace another string with some other text.Once replaced, search for the same text after that character position in the file. :wall:
E.g: Actual File content:
Hello
Name: Nitin Raj
Welcome to Unix... (4 Replies)
Discussion started by: dashing201
4 Replies
6. Shell Programming and Scripting
I have a list of strings in file:
10 10 AAA
120 13 BBBBB
23 11 CCCCC
11 32 DDDDDD
I want to replace first column of the text such as: 10, 129, 23, 11 with 11, 22, 33, 44.
I can do line by line, but just not sure how to replace partial string without... (1 Reply)
Discussion started by: ford99
1 Replies
7. Shell Programming and Scripting
I have file t1.log
Contents of t1.log file
Number of records processed:
Number of records rejected:
Error :
xyz ..........
abc ..........
aaa _]
start time :
end time :
Please let me know how i can remove the contents highlighted in red in the t1.log file.
Thanks
Sam (3 Replies)
Discussion started by: sam777
3 Replies
8. Shell Programming and Scripting
Hi Guys,
I need replace part of string in a file.
for example:
ABC=123
CDE=122
DEF=456
ABC=123
DED=333
ABC=123
I need replace the value after ABC=, highlighted in red. I want to get following result;
ABC=456
CDE=122
DEF=456
ABC=456
DED=333
ABC=456
Anybody can help me this.
... (8 Replies)
Discussion started by: ken6503
8 Replies
9. UNIX for Dummies Questions & Answers
Hi Everyone,
I have a requirement in ksh where i have a set of files in a directory. I need to search each and every file if a particular string is present in the file, delete that line and replace that line with another string expression in the same file.
I am very new to unix. Kindly help... (10 Replies)
Discussion started by: Pradhikshan
10 Replies
LEARN ABOUT DEBIAN
lfc-setacl
LFC-SETACL(1) LFC User Commands LFC-SETACL(1)
NAME
lfc-setacl - set LFC directory/file access control lists
SYNOPSIS
lfc-setacl [-d] [-m] [-s] acl_entries path...
DESCRIPTION
lfc-setacl sets the Access Control List associated with a LFC directory/file.
acl_entries is a comma separated list of entries. Each entry has colon separated fields: ACL type, id (uid or gid), permission. Only direc-
tories can have default ACL entries.
The entries look like:
user::perm
user:uid:perm
group::perm
group:gid:perm
mask:perm
other:perm
default:user::perm
default:user:uid:perm
default:group::perm
default:group:gid:perm
default:mask:perm
default:other:perm
The ACL type can be abbreviated to the first letter. The first "user" entry gives the permissions granted to the owner of the file. The
following "user" entries show the permissions granted to specific users, they are sorted in ascending order of uid. The first "group"
entry gives the permissions granted to the group owner of the file. The following "group" entries show the permissions granted to specific
groups, they are sorted in ascending order of gid. The "mask" entry is the maximum permission granted to specific users or groups. It
does not affect the "owner" and "other" permissions. The "mask" entry must be present if there are specific "user" or "group" entries.
"default" entries associated with a directory are inherited as access ACL by the files or sub-directories created in that directory. The
umask is not used. Sub-directories also inherit the default ACL as default ACL. As soon as there is one default ACL entry, the 3 default
ACL base entries (default user, default group, default other) must be present.
The entry processing conforms to the Posix 1003.1e draft standard 17.
The effective user ID of the process must match the owner of the file or the caller must have ADMIN privilege in the Cupv database.
path specifies the LFC pathname. If path does not start with /, it is prefixed by the content of the LFC_HOME environment variable.
uid can be given as the username or the corresponding numeric id.
gid can be given as the groupname or the corresponding numeric id.
perm can be expressed as a combination of characters rwx- or as a value between 0 and 7.
OPTIONS
-d remove ACL entries. The "perm" field is ignored.
-m modify existing ACL entries or add new entries.
-s set the ACL entries. The complete set of ACL entries is replaced.
EXAMPLES
Let's create a directory:
lfc-mkdir /grid/atlas/test/file.log/d6
and add write permission for user bcouturi:
lfc-setacl -m u:bcouturi:rwx,m:rwx /grid/atlas/test/file.log/d6
Let's create a directory:
lfc-mkdir /grid/atlas/test/file.log/d7
and add default ACLs to it:
lfc-setacl -m d:u::7,d:g::7,d:o:5 /grid/atlas/test/file.log/d7
Let's check the resulting ACLs:
lfc-getacl /grid/atlas/test/file.log/d7
# file: /grid/atlas/test/file.log/d7
# owner: baud
# group: c3
user::rwx
group::r-x #effective:r-x
other::r-x
default:user::rwx
default:group::rwx
default:other::r-x
Let's create a sub-directory and check the resulting ACLs:
lfc-mkdir /grid/atlas/test/file.log/d7/d2
lfc-getacl /grid/atlas/test/file.log/d7/d2
# file: /grid/atlas/test/file.log/d7/d2
# owner: baud
# group: c3
user::rwx
group::rwx #effective:rwx
other::r-x
default:user::rwx
default:group::rwx
default:other::r-x
Let's create a file in the same directory and check the resulting ACLs:
lfc-touch /grid/atlas/test/file.log/d7/f2
lfc-getacl /grid/atlas/test/file.log/d7/f2
# file: /grid/atlas/test/file.log/d7/f2
# owner: baud
# group: c3
user::rw-
group::rw- #effective:rw-
other::r--
EXIT STATUS
This program returns 0 if the operation was successful or >0 if the operation failed.
SEE ALSO
Castor_limits(4), lfc_chmod(3), lfc_chown(3), Cupvlist(1)
AUTHOR
LCG Grid Deployment Team
LFC
$Date: 2003/08/26 06:21:13 $ LFC-SETACL(1)