Sponsored Content
Full Discussion: ignoring multiple patterns
Top Forums Shell Programming and Scripting ignoring multiple patterns Post 302580255 by dbashyam on Thursday 8th of December 2011 03:11:43 AM
Old 12-08-2011
ignoring multiple patterns

Hi,

Using grep how to ignore multiple patterns

for example

# multiple
#installOption
#role
role
#ROLE

I want to ignore all that comes with # in a single command

If I use

Code:
grep -v \^\#"role" <filename>

The #role gets ingored but not #ROLE.

I want to ignore #installOption # multiple etc

Thanks a lot
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

grep for multiple patterns

I want to get a list of all the files in the current directory that have two patterns. I can do first grep of one pattern and then with the output do the grep of the second pattern. if the output of 1st pattern search results in many files, it is very difficult to do a grep of the 2nd pattern for... (1 Reply)
Discussion started by: tselvanin
1 Replies

2. Shell Programming and Scripting

Grep multiple patterns

Hi, Can we grep multiple patterns in UNIX. for example: cat /x/y/oratab | grep -i "pattern1|pattern2" .... etc I require the syntax for multiple patterns. | is not working as I explained in example. Malay (4 Replies)
Discussion started by: malaymaru
4 Replies

3. Shell Programming and Scripting

Grep for Multiple patterns

Hi All, I have a file. I need to find multiple patterns in a row and need those rows to divert to new file. I tried using grep -e / -E / -F options as given in man. But its not working. ==> cat testgrep.txt william,fernandes,xxxxx mark,morsov,yyyy yy=,xx= yyyy=,xxxx== ==>... (7 Replies)
Discussion started by: WillImm123
7 Replies

4. Shell Programming and Scripting

Find multiple patterns on multiple lines and concatenate output

I'm trying to parse COBOL code to combine variables into one string. I have two variable names that get literals moved into them and I'd like to use sed, awk, or similar to find these lines and combine the variables into the final component. These variable names are always VAR1 and VAR2. For... (8 Replies)
Discussion started by: wilg0005
8 Replies

5. Shell Programming and Scripting

Search multiple patterns in multiple files

Hi, I have to write one script that has to search a list of numbers in certain zipped files. For eg. one file file1.txt contains the numbers. File1.txt contains 5,00,000 numbers and I have to search each number in zipped files(The number of zipped files are around 1000 each file is 5 MB) I have... (10 Replies)
Discussion started by: vsachan
10 Replies

6. Shell Programming and Scripting

search multiple patterns

I have two lists in a file that look like a b b a e f c d f e d c I would like a final list a b c d e f I've tried multiple grep and awk but can't get it to work (8 Replies)
Discussion started by: godzilla07
8 Replies

7. Shell Programming and Scripting

Comparing 2 arrays but ignoring certain patterns

I'm trying to compare 2 array and print the difference at a 3rd file. However how am i going to compare this 2 arrays by ignoring certain patterns: For example: 1st array contains: ctahci cptcsa0 ctsata:25:seed cptcsa1:50:seed ctsata_1:25:seed 2nd array contains: cptcsa0 ctsata... (0 Replies)
Discussion started by: hongping
0 Replies

8. Shell Programming and Scripting

Print between multiple patterns

Hello Gurus, I have a file this Dir Path 1 Connection pool="somename"; "DataSource Name"="DS name"; Password="pwd"; User Id="uid";some other fields Dir Path2 Password="pwd2"; User id="uid2"; Connection pool="somename2"; "datasource name"="DS name2";some other fields. Under each dir... (14 Replies)
Discussion started by: sirababu
14 Replies

9. Shell Programming and Scripting

Grep from multiple patterns multiple file multiple output

Hi, I want to grep multiple patterns from multiple files and save to multiple outputs. As of now its outputting all to the same file when I use this command. Input : 108 files to check for 390 patterns to check for. output I need to 108 files with the searched patterns. Xargs -I {} grep... (3 Replies)
Discussion started by: Diya123
3 Replies

10. Shell Programming and Scripting

How to use grep with multiple patterns?

I am trying to grep a variable with multiple lines with multiple patterns below is the pattern list in a variable called "grouplst", each pattern is speerated by "|" grouplst="example1|example2|example3|example4|example5|example6|example7" I need to use the patterns above to grep a... (2 Replies)
Discussion started by: ajetangay
2 Replies
ALTER 
ROLE(7) PostgreSQL 9.2.7 Documentation ALTER ROLE(7) NAME
ALTER_ROLE - change a database role SYNOPSIS
ALTER ROLE name [ [ WITH ] option [ ... ] ] where option can be: SUPERUSER | NOSUPERUSER | CREATEDB | NOCREATEDB | CREATEROLE | NOCREATEROLE | CREATEUSER | NOCREATEUSER | INHERIT | NOINHERIT | LOGIN | NOLOGIN | REPLICATION | NOREPLICATION | CONNECTION LIMIT connlimit | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password' | VALID UNTIL 'timestamp' ALTER ROLE name RENAME TO new_name ALTER ROLE name [ IN DATABASE database_name ] SET configuration_parameter { TO | = } { value | DEFAULT } ALTER ROLE name [ IN DATABASE database_name ] SET configuration_parameter FROM CURRENT ALTER ROLE name [ IN DATABASE database_name ] RESET configuration_parameter ALTER ROLE name [ IN DATABASE database_name ] RESET ALL DESCRIPTION
ALTER ROLE changes the attributes of a PostgreSQL role. The first variant of this command listed in the synopsis can change many of the role attributes that can be specified in CREATE ROLE (CREATE_ROLE(7)). (All the possible attributes are covered, except that there are no options for adding or removing memberships; use GRANT(7) and REVOKE(7) for that.) Attributes not mentioned in the command retain their previous settings. Database superusers can change any of these settings for any role. Roles having CREATEROLE privilege can change any of these settings, but only for non-superuser and non-replication roles. Ordinary roles can only change their own password. The second variant changes the name of the role. Database superusers can rename any role. Roles having CREATEROLE privilege can rename non-superuser roles. The current session user cannot be renamed. (Connect as a different user if you need to do that.) Because MD5-encrypted passwords use the role name as cryptographic salt, renaming a role clears its password if the password is MD5-encrypted. The remaining variants change a role's session default for a configuration variable, either for all databases or, when the IN DATABASE clause is specified, only for sessions in the named database. Whenever the role subsequently starts a new session, the specified value becomes the session default, overriding whatever setting is present in postgresql.conf or has been received from the postgres command line. This only happens at login time; executing SET ROLE (SET_ROLE(7)) or SET SESSION AUTHORIZATION (SET_SESSION_AUTHORIZATION(7)) does not cause new configuration values to be set. Settings set for all databases are overridden by database-specific settings attached to a role. Superusers can change anyone's session defaults. Roles having CREATEROLE privilege can change defaults for non-superuser roles. Ordinary roles can only set defaults for themselves. Certain configuration variables cannot be set this way, or can only be set if a superuser issues the command. PARAMETERS
name The name of the role whose attributes are to be altered. SUPERUSER, NOSUPERUSER, CREATEDB, NOCREATEDB, CREATEROLE, NOCREATEROLE, CREATEUSER, NOCREATEUSER, INHERIT, NOINHERIT, LOGIN, NOLOGIN, REPLICATION, NOREPLICATION, CONNECTION LIMIT connlimit, PASSWORD password, ENCRYPTED, UNENCRYPTED, VALID UNTIL 'timestamp' These clauses alter attributes originally set by CREATE ROLE (CREATE_ROLE(7)). For more information, see the CREATE ROLE reference page. new_name The new name of the role. database_name The name of the database the configuration variable should be set in. configuration_parameter, value Set this role's session default for the specified configuration parameter to the given value. If value is DEFAULT or, equivalently, RESET is used, the role-specific variable setting is removed, so the role will inherit the system-wide default setting in new sessions. Use RESET ALL to clear all role-specific settings. SET FROM CURRENT saves the session's current value of the parameter as the role-specific value. If IN DATABASE is specified, the configuration parameter is set or removed for the given role and database only. Role-specific variable settings take effect only at login; SET ROLE (SET_ROLE(7)) and SET SESSION AUTHORIZATION (SET_SESSION_AUTHORIZATION(7)) do not process role-specific variable settings. See SET(7) and Chapter 18, Server Configuration, in the documentation for more information about allowed parameter names and values. NOTES
Use CREATE ROLE (CREATE_ROLE(7)) to add new roles, and DROP ROLE (DROP_ROLE(7)) to remove a role. ALTER ROLE cannot change a role's memberships. Use GRANT(7) and REVOKE(7) to do that. Caution must be exercised when specifying an unencrypted password with this command. The password will be transmitted to the server in cleartext, and it might also be logged in the client's command history or the server log. psql(1) contains a command password that can be used to change a role's password without exposing the cleartext password. It is also possible to tie a session default to a specific database rather than to a role; see ALTER DATABASE (ALTER_DATABASE(7)). If there is a conflict, database-role-specific settings override role-specific ones, which in turn override database-specific ones. EXAMPLES
Change a role's password: ALTER ROLE davide WITH PASSWORD 'hu8jmn3'; Remove a role's password: ALTER ROLE davide WITH PASSWORD NULL; Change a password expiration date, specifying that the password should expire at midday on 4th May 2015 using the time zone which is one hour ahead of UTC: ALTER ROLE chris VALID UNTIL 'May 4 12:00:00 2015 +1'; Make a password valid forever: ALTER ROLE fred VALID UNTIL 'infinity'; Give a role the ability to create other roles and new databases: ALTER ROLE miriam CREATEROLE CREATEDB; Give a role a non-default setting of the maintenance_work_mem parameter: ALTER ROLE worker_bee SET maintenance_work_mem = 100000; Give a role a non-default, database-specific setting of the client_min_messages parameter: ALTER ROLE fred IN DATABASE devel SET client_min_messages = DEBUG; COMPATIBILITY
The ALTER ROLE statement is a PostgreSQL extension. SEE ALSO
CREATE ROLE (CREATE_ROLE(7)), DROP ROLE (DROP_ROLE(7)), SET(7) PostgreSQL 9.2.7 2014-02-17 ALTER ROLE(7)
All times are GMT -4. The time now is 10:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy