Concatenate three lines into one


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Concatenate three lines into one
# 8  
Old 08-14-2014
Thank you everyone for your helpful posts! I used Don's code within a Kornshell Script (and I even got a loop of a List File of File Names to process multiple Raw files and parse them to Parsed Files to work!), and it did exactly what I needed it to do!

Here's the code I ran (Cognos_Audit_Log_File_List.lst file was pre-built earlier in the Script):

Code:
while read FILE
do
echo "$FILE" >> ${LOG_FILE}
awk '
cnt { out = out $0
 if(--cnt == 0) {
  gsub("\r", "", out)
  print out "\r"
 }
 next
}
substr($0, 29, 6) == "client" {
 cnt = 2
 out = $0
}' ${SOURCE_DIR}/$FILE > ${TARGET_DIR}/$FILE
done < Cognos_Audit_Log_File_List.lst

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to concatenate lines with specific pattern?

How to concatenate lines with specific pattern? I have data dumped from a table into text file. In some occurrence the data row is split into two rows. Example: 12345678|Global Test|Global Test Task|My Request|Date|Date|Date|1|1| 12345679|Global Test2|Global Test Task2|My... (8 Replies)
Discussion started by: nixtime
8 Replies

2. Shell Programming and Scripting

Need to concatenate spuriously separated lines

Given the pattern below: 3113296571|NULL|NULL|NULL||N| 1| 0| 926667| 1001036| 0| 3076120438|NULL|NULL|NULL|NULL|DUE FOR NEW CONSENT!|N|NULL| 10198318|2011-07-25-12.34.02.786000|NULL|NULL|NULL| 0 3113336478|NULL|NULL|NULL||N| 1| ... (16 Replies)
Discussion started by: lemele
16 Replies

3. Programming

Concatenate two lines in a fIle

Hi All, Can any one help me in finding the solution for concatenating two or more lines in a file and writing them to a temporary file. for Example: He is a wise student. So he got first rank. This is in a file i want the output as He is a wise student so he got first rank. into a file... (3 Replies)
Discussion started by: uday.sena.m
3 Replies

4. Shell Programming and Scripting

Concatenate lines between lines starting with a specific pattern

Hi, I have a file such as: --- >contig00001 length=35524 numreads=2944 gACGCCGCGCGCCGCGGCCAGGGCTGGCCCA CAGGCCGCGCGGCGTCGGCTGGCTGAG >contig00002 length=4242 numreads=43423 ATGCCGAAGGTCCGCCTGGGGCTGG CGCCGGGAGCATGTAGCG --- I would like to concatenate the lines not starting with ">"... (9 Replies)
Discussion started by: s052866
9 Replies

5. Shell Programming and Scripting

Concatenate multiple lines based.

Hello, I have been searching the forum for concatenation based on condition. I have been close enough but not got th exact one. infile: -----DB_Name ABC (X, Y,Z). DB_Name DEF (T). DB_Name GHI (U ,V,W). Desired Output file should be: ---------------------------DB_Name ABC... (8 Replies)
Discussion started by: indrajit_u
8 Replies

6. Shell Programming and Scripting

concatenate lines in pairs

Hi, I have a text file with the following contents /C=IT/O=INFN/OU=Personal Certificate/L=Napoli/CN=Some guy /C=IT/O=INFN/CN=INFN CA /O=Grid/O=NorduGrid/OU=uninett.no/CN=Another guy /O=Grid/O=NorduGrid/CN=NorduGrid Certification Authority /C=TW/O=AP/OU=GRID/CN=Someone else... (5 Replies)
Discussion started by: kerl
5 Replies

7. Shell Programming and Scripting

Concatenate two lines in one

Does anyone know a way I can fix my file below where it has lines that are cut? Just like the (notice the space before ms,c=PH).. dn: cn=english,ou=Messaging,ou=lang,o=subject,t=j ms,c=PH which should be dn: cn=english,ou=Messaging,ou=lang,o=subject,t=jms,c=PH The whole text file... (5 Replies)
Discussion started by: Orbix
5 Replies

8. Shell Programming and Scripting

concatenate lines using shell scripting

i have a mega file in this format: a, b, c, d, = a2, b2, c2, d2, = a3, b3 = i want to combine lines until = meet. the result should be : a,b,c,d, a2,b2,c3,d2 a3,b3 (13 Replies)
Discussion started by: dtdt
13 Replies

9. Shell Programming and Scripting

Concatenate lines in a single paragraph

Hi all, May you help me with this? After extract only some lines that I need from a file, I would like to concatenate the remaining lines in a single line (paragraph). Source file pattern: Event Type: Warning Event Source: Sorting Event Category: None Event ID: 1188 Date: 9/10/2008... (4 Replies)
Discussion started by: cgkmal
4 Replies

10. UNIX Desktop Questions & Answers

How to concatenate consecutive lines

I have a few lines like -- feature 1, subfeat 0, type 3, subtype 1, value 0, -- feature 1, subfeat 0, type 1, subtype 1, value 0, I would like to concatenate the... (1 Reply)
Discussion started by: shivi707
1 Replies
Login or Register to Ask a Question
AUDISP-RACF(8)						  System Administration Utilities					    AUDISP-RACF(8)

NAME
audispd-zos-remote - z/OS Remote-services Audit dispatcher plugin SYNOPSIS
audispd-zos-remote [ config-file ] DESCRIPTION
audispd-zos-remote is a remote-auditing plugin for the Audit subsystem. It should be started by the audispd(8) daemon and will forward all incoming audit events, as they happen, to a configured z/OS SMF (Service Management Facility) database, through an IBM Tivoli Directory Server (ITDS) set for Remote Audit service. See SMF MAPPING section below for more information about the resulting SMF record format. audispd(8) must be configured to start the plugin. This is done by a configuration file usually located at /etc/audisp/plugins.d/aud- ispd-zos-remote.conf, but multiple instances can be spawned by having multiple configuration files in /etc/audisp/plugins.d for the same plugin executable (see audispd(8)). Each instance needs a configuration file, located by default at /etc/audisp/zos-remote.conf. Check zos-remote.conf(5) for details about the plugin configuration. OPTIONS
config-file Use an alternate configuration file instead of /etc/audisp/zos-remote.conf. SIGNALS
audispd-zos-remote reacts to SIGTERM and SIGHUP signals (according to the audispd(8) specification): SIGHUP Instructs the audispd-zos-remote plugin to re-read it's configuration and flush existing network connections. SIGTERM Performs a clean exit. audispd-zos-remote will wait up to 10 seconds if there are queued events to be delivered, dropping any remaining queued events after that time. IBM z/OS ITDS Server and RACF configuration In order to use this plugin, you must have an IBM z/OS v1R8 (or higher) server with IBM Tivoli Directory Server (ITDS) configured for Remote Audit service. For more detailed information about how to configure the z/OS server for Remote Auditing, refer to z/OS V1R8.0-9.0 Intergrated Security Services Enterprise Identity Mapping (EIM) Guide and Reference (http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/FRAMESET/EIMA1140/CCONTENTS?DT=20070827115119), chapter "2.0 - Working with remote services". Enable ITDS to process Remote Audit requests To enable ITSD to process Remote Audit requests, the user ID associated with ITDS must be granted READ access to the IRR.AUDITX FACILITY Class profile (the profile used to protect the R_Auditx service). This user ID can usually be found in the STARTED Class profile for the ITDS started procedure. If the identity associated with ITDS is ITDSUSER, the administrator can configure RACF to grant Remote Auditing processing to ITDS with the following TSO commands: TSO Commands: Grant ITDSUSER READ access to IRR.AUDITX FACILITY Class profile rdefine FACILITY IRR.RAUDITX uacc(none) permit IRR.RAUDITX class(FACILITY) id(ITDSUSER) access(READ) Create/enable RACF user ID to perform Remote Audit requests A z/OS RACF user ID is needed by the plugin - Every Audit request performed by the plugin will use a RACF user ID, as configured in the plugin configuration zos-remote.conf(5). This user ID needs READ access to FACILITY Class resource IRR.LDAP.REMOTE.AUDIT. If the user ID is BINDUSER, the administrator can configure RACF to enable this user to perform Remote Auditing requests with the following TSO commands: TSO Commands: Enable BINDUSER to perform Remote Audit requests rdefine FACILITY IRR.LDAP.REMOTE.AUDIT uacc(none) permit IRR.LDAP.REMOTE.AUDIT class(FACILITY) id(BINDUSER) access(READ) Add @LINUX Class to RACF When performing remote auditing requests, the audispd-zos-remote plugin will use the special @LINUX CDT Class and the audit record type (eg.: SYSCALL, AVC, PATH...) as the CDT Resource Class for all events processed. To make sure events are logged, the RACF server must be configured with a Dynamic CDT Class named @LINUX with correct sizes and attributes. The following TSO commands can be used to add this class: TSO Commands: Add @LINUX CDT Class rdefine cdt @LINUX cdtinfo(posit(493) FIRST(alpha,national,numeric,special) OTHER(alpha,national,numeric,special) RACLIST(REQUIRED) case(asis) generic(allowed) defaultuacc(none) maxlength(246)) setr classact(cdt) setr raclist(cdt) setr raclist(cdt) refresh setr classact(@LINUX) setr raclist(@LINUX) setr generic(@LINUX) Add profiles to the @LINUX Class Once the CDT Class has been defined, you can add profiles to it, specifying resources (wildcards allowed) to log or ignore. The following are examples: TSO Commands: Log only AVC records (One generic and one discrete profile): rdefine @LINUX * uacc(none) audit(none(read)) rdefine @LINUX AVC uacc(none) audit(all(read)) setr raclist(@LINUX) refresh TSO Commands: Log everything (One generic profile): rdefine @LINUX * uacc(none) audit(all(read)) setr raclist(@LINUX) refresh Resources always match the single profile with the best match. There are many other ways to define logging in RACF. Please refer to the server documentation for more details. SMF Mapping The ITDS Remote Audit service will cut SMF records of type 83 subtype 4 everytime it processes a request. This plugin will issue a remote audit request for every incoming Linux Audit record (meaning that one Linux record will map to one SMF record), and fill this type's records with the following: Link Value The Linux event serial number, encoded in network-byte order hexadecimal representation. Records within the same Event share the same Link Value. Violation Always zero(0) - False Event Code Always two(2) - Authorization event Event Qualifier Zero(0) - Success, if the event reported success=yes or res=success, Three(3) - Fail, if the event reported success=no or res=failed, or One(1) - Info otherwise. Class Always @LINUX Resource The Linux record type for the processed record. e.g.: SYSCALL,AVC,PATH,CWD etc. Log String Textual message bringing the RACF user ID used to perform the request, plus the Linux hostname and the record type for the first record in the processed event. e.g.: Remote audit request from RACFUSER. Linux (hostname.localdomain):USER_AUTH Data Field List Also known as relocates, this list will bring all the field names and values in a fieldname=value format, as a type 114 (Appication spe- cific Data) relocate. The plug-in will try to interpret those fields (i.e.: use human-readable username root instead of numeric userid 0) whenever possible. Currently, this plugin will also add a relocate type 113 (Date And Time Security Event Occurred) with the Event Time- stamp in the format as returned by ctime(3). ERRORS
Errors and warnings are reported to syslog (under DAEMON facility). In situations where the event was submitted but the z/OS server returned an error condition, the logged message brings a name followed by a human-readable description. Below are some common errors condi- tions: NOTREQ - No logging required Resource (audit record type) is not set to be logged in the RACF server - The @LINUX Class profile governing this audit record type is set to ignore. See IBM z/OS RACF Server configuration UNDETERMINED - Undetermined result No profile found for specified resource. There is no @LINUX Class configured or no @LINUX Class profile associated with this audit record type. See IBM z/OS RACF Server configuration UNAUTHORIZED - The user does not have authority the R_auditx service The user ID associated with the ITDS doesn't have READ access to the IRR.AUDITX FACILITY Class profile. See IBM z/OS RACF Server configuration UNSUF_AUTH - The user has unsuficient authority for the requested function The RACF user ID used to perform Remote Audit requests (as configured in zos-remote.conf(5)) don't have access to the IRR.LDAP.REMOTE.AUDIT FACILITY Class profile. See IBM z/OS RACF Server configuration BUGS
The plugin currently does remote auditing in a best-effort basis, and will dischard events in case the z/OS server cannot be contacted (network failures) or in any other case that event submission fails. FILES
/etc/audisp/plugins.d/audispd-zos-remote.conf /etc/audisp/zos-remote.conf SEE ALSO
auditd(8), zos-remote.conf(5). AUTHOR
Klaus Heinrich Kiwi <klausk@br.ibm.com> IBM
Oct 2007 AUDISP-RACF(8)