12-23-2008
extract set of matching records
i have a pipe delimited file with records spread in many lines.
i need to extract those records
1)having X in beginning of that record
2)and having at least one Y in beginning before other record begins
eg:
X|Rec1|
A|Rec1|
Y|Rec1|
X|Rec2|
Y|Rec2|
Z|Rec3|
X|Rec4|
M|Rec4|
X|Rec5|
so, lines Rec1,Rec2 have to be in out.DAT and Rec3,Rec4,Rec5 in err.DAT
thanks.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have two files say file1 and file2.
I want to check the number of records in file1 and if its atleast 2 (i.e., 2 or greater than 2 ) then I have to check records in file2 .If records in file2 is atleast 1 (i.e. if its not empty ) i have to set some conditions .
Could you pls... (3 Replies)
Discussion started by: mavesum
3 Replies
2. Shell Programming and Scripting
Hi Experts,
back at this forum again. Have a tab separated file like this ---
ACCNN AMT(E/$) TYPE ID
11233 23.20($) AUTH 339
11233 19.00($) FINAL 339
11234 349.84($) AUTH 42332
11234 ... (12 Replies)
Discussion started by: PG3
12 Replies
3. Shell Programming and Scripting
Hi all
I have a file with records starting with "Page" has a first column.
some of the records have some other junk characters has first column.
so pls help me to remove rows which is not having "Page" has a first column.
Thanks,
Baski (2 Replies)
Discussion started by: baskivs
2 Replies
4. Shell Programming and Scripting
file1
abcd
efgh
ijkl
mnop
file2
mnop
qrst
uvwx
xyza
file3
1234
4567 (8 Replies)
Discussion started by: rajivrsk
8 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I need to find records with a search string from a file. Search strings are provided in a file.
For eg. search_String.txt file is like below
chicago
mexico
newark
sanhose
and the file from where the records need to be fetched is given below
src_file:... (1 Reply)
Discussion started by: sbhuvana20
1 Replies
6. Shell Programming and Scripting
Hi,
I have the following files.
cat 1.txt
cat 2.txt
output.txt
The logic is as follows.... (10 Replies)
Discussion started by: jacobs.smith
10 Replies
7. Shell Programming and Scripting
hello all,
I have requirement to identify similar records matching about 80% to 90%.I have to black list customers with multiple accounts.
The data is in the Oracle Database, but is there any way I can get the data into flat file and compare the strings and fetch similar matching records?
... (2 Replies)
Discussion started by: kashik786
2 Replies
8. Shell Programming and Scripting
Hi,
I'm very new to these forums. I was wondering if someone could help an AWK beginner with a pattern matching
an actor to his appearance in movies, which would be stored as records. Let's say we have a database of 4 movies (each movie a record with name, studio + year, and actor fields with... (2 Replies)
Discussion started by: Jill Ceke
2 Replies
9. Shell Programming and Scripting
My objective is to get the non matching records of previous day with current day.
eg, file1 contains
1 a
2 b
and file2 contains:
2 b
3 c
then expected output is
3 c¨
another example
file 1 contains:
1 a
2 b
file 2 contains
1 c
2 b (8 Replies)
Discussion started by: newbie2014
8 Replies
10. UNIX for Advanced & Expert Users
Hello,
I'm on a Solaris 10 and doing backup using a tape. The records in/out are way off but with no other errors. Is that normal? What could be wrong?
Thanks in advance!
Steve
---------------------
ufsdump 0f - /dev/dsk/c0d0s0 2>> /var/log/backupOS.log | ssh myhost dd... (1 Reply)
Discussion started by: steve041
1 Replies
LEARN ABOUT CENTOS
eventlogadm
EVENTLOGADM(8) System Administration tools EVENTLOGADM(8)
NAME
eventlogadm - push records into the Samba event log store
SYNOPSIS
eventlogadm [-s] [-d] [-h] -o addsource EVENTLOG SOURCENAME MSGFILE
eventlogadm [-s] [-d] [-h] -o write EVENTLOG
eventlogadm [-s] [-d] [-h] -o dump EVENTLOG RECORD_NUMBER
DESCRIPTION
This tool is part of the samba(1) suite.
eventlogadm is a filter that accepts formatted event log records on standard input and writes them to the Samba event log store. Windows
client can then manipulate these record using the usual administration tools.
OPTIONS
-s FILENAME
The -s option causes eventlogadm to load the configuration file given as FILENAME instead of the default one used by Samba.
-d
The -d option causes eventlogadm to emit debugging information.
-o addsource EVENTLOG SOURCENAME MSGFILE
The -o addsource option creates a new event log source.
-o write EVENTLOG
The -o write reads event log records from standard input and writes them to the Samba event log store named by EVENTLOG.
-o dump EVENTLOG RECORD_NUMBER
The -o dump reads event log records from a EVENTLOG tdb and dumps them to standard output on screen.
-h
Print usage information.
EVENTLOG RECORD FORMAT
For the write operation, eventlogadm expects to be able to read structured records from standard input. These records are a sequence of
lines, with the record key and data separated by a colon character. Records are separated by at least one or more blank line.
The event log record field are:
o LEN - This field should be 0, since eventlogadm will calculate this value.
o RS1 - This must be the value 1699505740.
o RCN - This field should be 0.
o TMG - The time the eventlog record was generated; format is the number of seconds since 00:00:00 January 1, 1970, UTC.
o TMW - The time the eventlog record was written; format is the number of seconds since 00:00:00 January 1, 1970, UTC.
o EID - The eventlog ID.
o ETP - The event type -- one of "INFO", "ERROR", "WARNING", "AUDIT SUCCESS" or "AUDIT FAILURE".
o ECT - The event category; this depends on the message file. It is primarily used as a means of filtering in the eventlog viewer.
o RS2 - This field should be 0.
o CRN - This field should be 0.
o USL - This field should be 0.
o SRC - This field contains the source name associated with the event log. If a message file is used with an event log, there will be a
registry entry for associating this source name with a message file DLL.
o SRN - The name of the machine on which the eventlog was generated. This is typically the host name.
o STR - The text associated with the eventlog. There may be more than one string in a record.
o DAT - This field should be left unset.
EXAMPLES
An example of the record format accepted by eventlogadm:
LEN: 0
RS1: 1699505740
RCN: 0
TMG: 1128631322
TMW: 1128631322
EID: 1000
ETP: INFO
ECT: 0
RS2: 0
CRN: 0
USL: 0
SRC: cron
SRN: dmlinux
STR: (root) CMD ( rm -f /var/spool/cron/lastrun/cron.hourly)
DAT:
Set up an eventlog source, specifying a message file DLL:
eventlogadm -o addsource Application MyApplication | \
%SystemRoot%/system32/MyApplication.dll
Filter messages from the system log into an event log:
tail -f /var/log/messages | \
my_program_to_parse_into_eventlog_records | \
eventlogadm SystemLogEvents
VERSION
This man page is correct for version 3.0.25 of the Samba suite.
AUTHOR
The original Samba software and related utilities were created by Andrew Tridgell. Samba is now developed by the Samba Team as an Open
Source project similar to the way the Linux kernel is developed.
Samba 4.0 06/17/2014 EVENTLOGADM(8)