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
aud_audit_events(5)													       aud_audit_events(5)

NAME
aud_audit_events - Auditable events for the audit services DESCRIPTION
Code is in place for auditing audit service-significant events. Among these events are: Administrative operations These are subdivided into modify and query operations. Filter operations These are subdivided into modify and query operations. Event class definitions, together with filters, control the auditing execution at these code points. Filters can be updated dynamically. Filter files are maintained by a per-host audit daemon, and are shared among all the audit clients on the same host. The dcecp command interface program is used for maintaining the filters. (See the dcecp reference page.) The dcecp command is executable by all users and system administrators. The control on who is allowed to modify filters is done through audit daemon's ACL, which maintains the filters. The Audit Service RPC interfaces include audit_control and audit_filter operations. Administrative Operations The dce_audit_admin_modify and dce_audit_admin_query event classes lump together the administrative operations that are performed on the Audit daemon. The dce_audit_admin_modify event class has the following events that modify the operation of the Audit daemon: EVT_MODIFY_STATE - Enables or disables the Audit daemon for logging. EVT_MODIFY_SSTRATEGY - Modifies storage strategy. This can be any of the following: Save - If the trail is full, it is backed up and renamed with a timestamp then writes on the original trail again. Wrap - If the trail is full, goes back to the beginning of the file, overwriting previously written records. EVT_REWIND - Rewinds the Audit daemon's central trail file. EVT_STOP - Stops the Audit daemon. The following are the audit code points in the Audit Service interfaces, with their Event Types, Event Classes, and any Event-Specific Information. EVT_MODIFY_STATE (0x306, dce_audit_admin_modify) None EVT_MODIFY_SSTRATEGY (0x305, dce_audit_admin_modify) None EVT_REWIND (0x307, dce_audit_admin_modify) None EVT_STOP (0x308, dce_audit_admin_modify) None The dce_audit_admin_query event class has two events: EVT_SHOW_SSTRATEGY - Shows the storage strategy. EVT_SHOW_STATE - Shows the state of the Audit daemon. Following are the details of this event class: EVT_SHOW_SSTRATEGY (0x309, dce_audit_admin_query) None EVT_SHOW_STATE (0x30a, dce_audit_admin_query) None Filter Operations The dce_audit_filter_modify and dce_audit_filter_query event classes are the filter operations that the Audit daemon handles. The dce_audit_filter_modify event class has the following events: EVT_ADD_FILTER - Adds a filter. EVT_DELETE_FILTER - Removes all guides for a specific subject. EVT_REMOVE_FILTER - Removes a specific guide for a specific subject. Following are the details of this event class: EVT_ADD_FILTER (0x303, dce_audit_filter_modify) None. EVT_DELETE_FILTER (0x300, dce_audit_filter_modify) None. EVT_REMOVE_FILTER (0x304, dce_audit_filter_modify) None. The dce_audit_filter_query contains two events: EVT_LIST_FILTER - Lists all subjects that have filters. EVT_SHOW_FILTER - Shows all fil- ters for a specific principal. Following are the details of this event class. EVT_LIST_FILTER (0x302, dce_audit_filter_query) None. EVT_SHOW_FILTER (0x301, dce_audit_filter_query) aud_c_evt_info_long_int esl_type aud_c_evt_info_char_string subject_name RELATED INFORMATION
Commands: dcecp(1m). Files: event_class.5. aud_audit_events(5)