08-16-2009
pattern match question
I have a pattern match problem I could use your help with
I have a file in the following format (names.txt)
jae,doe
john,doe
jay,doe
I need to loop through the file using FOR and check the names in names.txt against another file (information.txt).
information.txt is in the following format
jae,doe xxxxx xxxxxx xxxxxxxx xxxxxxx xxxxxx xxxxxxx xxxxxxxxx xxxxxx
or could be
xxxxxx xxxxxx jae,doe xxxxx xxxxxx xxxxxxxx xxxxxxxx xxxxxxxxx
at various points throughout the file
I need to be able to match $x (the variable from the for loop) against this information.txt file and print the line only if $x is in the first column of the file. In this particular situation $x can occur in the second, 3rd, 4th or 5th etc columns of the file. Anything but $x in the first column needs to be ignored.
Any ideas friends?
thanks
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I need a clarification on one of the scripts that i have written, I new to file handling and i need help:
I am trying to find a particular pattern in a file "****** PBX" in set of 5 files named:
xy.cc3
xv.cc3
xx.cc3
xr.cc3
xd.cc3
in a directory. If i find the files starting with these... (16 Replies)
Discussion started by: bsandeep_80
16 Replies
2. Shell Programming and Scripting
My input file:
<accession>Q91G55</accession>
<name>043L_IIV6</name>
<protein>
<recommendedName>
<location>
<position position="294"/>
</location>
<fullName>Uncharacterized protein 043L</fullName>
<accession>P18556</accession>
<name>1106L_ASFB7</name>
<protein>
<recommendedName>... (5 Replies)
Discussion started by: patrick87
5 Replies
3. Shell Programming and Scripting
Hi, I have 2 files that I have modified to basically match each other, however I want to determine what (if any) line in file 1 does not exist in file 2. I need to match column $1 and $2 as a single string in file1 to $1 and $2 in file2 as these two columns create a match.
I'm stuck in an AWK... (9 Replies)
Discussion started by: right_coaster
9 Replies
4. Shell Programming and Scripting
i need to search for a pattern from a big file and print everything expect the next 6 lines from where the pattern match was made. (8 Replies)
Discussion started by: chidori
8 Replies
5. Shell Programming and Scripting
Hello Guyz
I have been following this forum for a while and the solutions provided are super useful. I currently have a scenario where i need to search for a pattern and start searching by keeping the first pattern as a baseline
ABC
DEF
LMN
EFG
HIJ
LMN
OPQ
In the above text i need to... (8 Replies)
Discussion started by: RickCharles
8 Replies
6. UNIX for Dummies Questions & Answers
Hi experts , im new to Unix,AWK ,and im just not able to get this right.
I need to match for some patterns if it matches I need to print the next few words to it.. I have only three such conditions to match… But I need to print only those words that comes after satisfying the first condition..... (2 Replies)
Discussion started by: 100bees
2 Replies
7. Shell Programming and Scripting
I have an application(Minecraft Server) that generates a logfile live. Using Crontab and screen I send a 'list' command every minute.
Sample Log view:
2013-06-07 19:14:37 <Willrocksyea1> hello*
2013-06-07 19:14:41 <Gromden29> hey
2013-06-07 19:14:42 Gromden29 lost connection:... (1 Reply)
Discussion started by: gatekeeper258
1 Replies
8. Shell Programming and Scripting
Ive used this snippet of code on a solaris box thousands of times.
But it isnt working on the new linux box
sed -n '/interface LoopBack0/{N;/ ip address /p;}' *.conf
its driving me nuts !!
Is there something Im missing ? (7 Replies)
Discussion started by: popeye
7 Replies
9. Shell Programming and Scripting
Im using the command below , but thats not the output that i want. it only prints the odd and even numbers.
awk '{if(NR%2){print $0 > "1"}else{print $0 > "2"}}'
Im hoping for something like this
file1:
Text hi this is just a test
text1 text2 text3 text4 text5 text6
Text hi... (2 Replies)
Discussion started by: invinzin21
2 Replies
10. Shell Programming and Scripting
Hello Experts , require help . See below output:
File inputs
------------------------------------------
Server Host = mike
id rl images allocated last updated density
vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies
LEARN ABOUT DEBIAN
doveadm-user
DOVEADM-USER(1) Dovecot DOVEADM-USER(1)
NAME
doveadm-user - Perform a user lookup in Dovecot's userdbs
SYNOPSIS
doveadm [-Dv] user [-a userdb_socket_path] [-f field] [-x auth_info] user ...
DESCRIPTION
The user command is used to perform a user lookup - to show what information Dovecot sees about the user(s), or if it exists at all in the
configured userdb(s).
The auth_info may be useful when the userdb is for example a SQL database and you are using %variables, like %s or %l, in the user_query
setting. Or when you have configured the userdb in a way like this:
userdb {
driver = passwd-file
args = /etc/%s.passwd
}
OPTIONS
Global doveadm(1) options:
-D Enables verbosity and debug messages.
-v Enables verbosity, including progress counter.
Command specific options:
-a userdb_socket_path
This option is used to specify an absolute path to an alternative UNIX domain socket.
By default doveadm(1) will use the socket /var/run/dovecot/auth-userdb. The socket may be located in another directory, when the
default base_dir setting was overridden in /etc/dovecot/dovecot.conf.
-f field
When this option and the name of a userdb field is given, doveadm(1) will show only the value of the specified field.
-x auth_info
auth_info specifies additional conditions for the user command. The auth_info option string has to be given as name=value pair.
For multiple conditions the -x option could be supplied multiple times.
Possible names for the auth_info are:
service
The service for which the userdb lookup should be tested. The value may be the name of a service, commonly used with Dove-
cot. For example: imap, pop3 or smtp.
lip The local IP address (server) for the test.
rip The remote IP address (client) for the test.
lport The local port, e.g. 143
rport The remote port, e.g. 24567
ARGUMENTS
user Is a user's login name. Depending on the configuration, a login name may be for example jane or john@example.com. It's also possi-
ble to use '*' and '?' wildcards (e.g. -u *@example.org).
EXAMPLE
Perform a user lookup for the users jane and john@example.com.
doveadm user jane john@example.com
userdb: jane
uid : 8001
gid : 8001
home : /home/jane
mail : sdbox:~/sdbox
plugins : sieve
quota_rule: *:storage=150M
userdb: john@example.com
home : /srv/mail/8/70312/79832
uid : 79832
gid : 70312
mail : mdbox:~/mdbox
The next example shows a user lookup, using wildcards.
doveadm user *.?oe@example.net
jane.doe@example.net
judy.roe@example.net
john.doe@example.net
REPORTING BUGS
Report bugs, including doveconf -n output, to the Dovecot Mailing List <dovecot@dovecot.org>. Information about reporting bugs is avail-
able at: http://dovecot.org/bugreport.html
SEE ALSO
doveadm(1)
Dovecot v2.1 2011-11-04 DOVEADM-USER(1)