07-09-2011
Compare 2 files print the lines of file 2 that contain a string from file 1
Hello I am a new unix user, and I have a work related task to compare 2 files and print all of the lines in file 2 that contain a string from file 1 Note: the fields are in different columns in the files. I suspect the is a good use for awk? Thanks for your time & help
File 1
123 232 W343
321 323 W454
999 666 W777
File 2
333 W343 989
577 W323 979
888 W777 555
Result =
333 W343 989
888 W777 555
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I want to print the lines in a file that matches particular string format using shell scripting. (4 Replies)
Discussion started by: sudhakaryadav
4 Replies
2. Shell Programming and Scripting
Hi,
I have two tab separated files;
file1:
S.No ddi fi cu o/l t+ t-
1 0.5 0.6 o 0.1 0.2
2 0.2 0.3 l 0.3 0.4
3 0.5 0.8 l 0.1 0.6
... (5 Replies)
Discussion started by: vasanth.vadalur
5 Replies
3. Shell Programming and Scripting
hello,
I go text file like this
E:/DDD/Dyndede/wwww
E:/DDD/sss.com/ffffg/fff
E:/DDD/vvvvvv/dd
E:/DDD/sss.com/bbbbbb
E:/DDD/sss.com/nnnn/xxI want to print
/alpha.jpg at the end of every lines like that
E:/DDD/Dyndede/wwww/alpha.jpg
E:/DDD/sss.com/ffffg/fff/alpha.jpg... (8 Replies)
Discussion started by: davidkhan
8 Replies
4. Shell Programming and Scripting
Hello,
I am strugling from quite a some time to compare flat files with over 1 million records could anyone please help me.
I want to compare two pipe delimited flat files, file1 with file2 and output the unmatched rows from file2 in file3
Sample File1:
... (9 Replies)
Discussion started by: suhaeb
9 Replies
5. Shell Programming and Scripting
I have a command which prints #lines after and before the search string in the huge file
nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r;print;c=a}b{r=$0}' b=0 a=10 s="STRING1" FILE
The file is 5 gig big.
It works great and prints 10 lines after the lines which contains search string in... (8 Replies)
Discussion started by: prash184u
8 Replies
6. Shell Programming and Scripting
Hello. I have two files. FILE1 was extracted from FILE2 and modified thanks to help from this post. Now I need to replace the extracted, modified lines into the original file (FILE2) to produce the FILE3.
FILE1
1466 55.27433 14.72050 -2.52E+03 3.00E-01 1.05E+04 2.57E+04
1467 55.27433... (1 Reply)
Discussion started by: jm4smtddd
1 Replies
7. Shell Programming and Scripting
Hi,
I have a file with contents
test id text day
test sah dh dhs
yeay fg jsh jsjk
my need:
I give a string as a input, it check the file and display the lines with the given string
e.g
input : test
output:
test id text day
test sah dh dhs (1 Reply)
Discussion started by: nanthagopal
1 Replies
8. Shell Programming and Scripting
Hi,
I have multiple files that each contain one column of strings:
File1:
123abc
456def
789ghi
File2:
123abc
456def
891jkl
File3:
234mno
123abc
456def
In total I have 25 of these type of file. (5 Replies)
Discussion started by: owwow14
5 Replies
9. Shell Programming and Scripting
Hi,
I want to compare two columns from file1 with another two column of file2 and print matched and unmatched column like this
File1
1 rs1 abc
3 rs4 xyz
1 rs3 stu
File2
1 kkk rs1 AA 10
1 aaa rs2 DD 20
1 ccc ... (2 Replies)
Discussion started by: justinjj
2 Replies
10. Shell Programming and Scripting
HI,
I have 2 text files. file1 and file2.
file1.txt (There are no duplicates in this file)
1234
3232
4343
3435
6564
6767
1213
file2.txt
1234,wq,wewe,qwqw
1234,as,dfdf,dfdf
4343,asas,sdds,dsds
6767,asas,fdfd,fdffd
I need to search each number in file1.txt in file2.txt's 1st... (6 Replies)
Discussion started by: Little
6 Replies
LEARN ABOUT DEBIAN
rlm_dbm_parse
RLM_DBM_PARSE(8) System Manager's Manual RLM_DBM_PARSE(8)
NAME
rlm_dbm_parse - transforms simple syntax into rlm_dbm format
SYNOPSIS
rlm_dbm_parse [-c] [-d raddb] [-i inputfile] [-o outputfile] [-x] [-v] [-q] [username ...]
DESCRIPTION
rlm_dbm_parse reads a file of the syntax defined below, and writes a database file usable by rlm_dbm or edits current database.
INPUT FORMAT
rlm_dbm_parse reads a format similar to the one used by the files module. In incomplete RFC2234 ABNF, it looks like this:
entries = *entry
entry = identifier TAB definition
identifier = username / group-name
username = +PCHAR
groupname = +PCHAR
definition = (check-item ",")* LF ( *( reply-item ",") / ";" ) LF
check-item = AS IN FILES
reply-item = AS IN FILES
* need definition of username and groupname
As an example, these are the standard files definitions (files module).
DEFAULT Service-Type == Framed-User
Framed-IP-Address = 255.255.255.254,
Framed-MTU = 576,
Service-Type = Framed-User,
Fall-Through = Yes
#except who call from number 555-666
DEFAULT Auth-Type := Reject,Service-Type ==Framed-User,
Calling-Station-ID == "555-666"
#or call number 555-667
DEFAULT Auth-Type := Reject,Service-Type ==Framed-User,
Calling-Station-ID == "555-667"
To be a valid rlm_dbm input file, it should look like this:
DEFAULT Service-Type == Framed-User # (1)
Framed-IP-Address = 255.255.255.254, # comma, list cont'd
Framed-MTU = 576,
Service-Type = Framed-User,
Fall-Through = Yes #
, end of list
Auth-Type := Reject,Service-Type ==Framed-User, # (2)
Calling-Station-ID == "555-666"
; # ;, no reply items
Auth-Type := Reject,Service-Type ==Framed-User, # (3)
Calling-Station-ID == "555-667"
; # ditto
This user (the DEFAULT user) contains three entries, 1, 2 and 3. The first entry has a list of reply items, terminated by a reply item
without a trailing comma. Entries 2 and 3 has empty reply lists, as indicated by the semicolon. This is necessary to separate an empty line
(which is ignored) from the empty list. Definition Fall-Through = Yes used in order to say module to check next record. By default Fall-
Through = Yes.
OPTIONS
-d raddb
Use raddb as the radiusd configuration directory.
-i inputfile
Use file as the input file. If not defined then use standard input.
-o outputfile
Use file as the output file.
-c Create a new database (empty output file before writing)
-x Enable debug mode. Multiple x flags increase debug level.
-q Do not print statistics (quiet).
-v Print the version and exit.
-r Remove a username or group name from the database.
SEE ALSO
radiusd(8)
AUTHORS
Author:
Andrei Koulik <rlm_dbm@agk.nnov.ru>
Documentation:
Bjorn Nordbo <bn@nextra.com>
RLM_DBM_PARSE(8)