02-07-2012
Parsing and filtering multiline text into comma separated line
I have a log file that contains several reports with following format.
<Start of delimiter> Report1 header
Report1 header continue
Report1 header continue
Record1 header
Record1 header continue
Record1 header continue
field1 field2 field3 field4
------ ------ ------ ------
value1 value2 value3 value4
Record1 header
Record1 header continue
Record1 header continue
field5 field6 field7 field8 field9
------ ------ ------ ------ ------
value5 value6 value7 value8 value9
Record1 header
Record1 header continue
Record1 header continue
field10 field11 field12
------ ------ ------
value10 value11 value12
Report1 Footer
<End of delimiter>
<Start of delimiter> Report2 header
Report2 header continue
Report2 header continue
Record2 header
Record2 header continue
Record2 header continue
field13 field14
------ ------
value13 value14
Record2 header
Record2 header continue
Record2 header continue
field15 field16 field17 field18 field19
------ ------ ------ ------ ------
value15 value16 value17 value18 value19
Report2 Footer
<End of delimiter>
field1, field2 etc are various names and are all different and not necessarily written as field1, field2
I am interested in parsing the log file so that final output looks like this
value1,value2,value3,value4,value5,value6,value7,value8,value9,value10,value11,value12,value13,value 14,value15,value16,value17,value18,value19
I would appreciate if people throw in some ideas on how to filter the log file so that only comma separated values are printed in single line.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi unix guru's
I want to execute a shell script like ksh printdetails.ksh Andy,Bob,Daisy,Johnson
like passing all the four names in the as the arguments and these arguments are varies between 1 to 10.
How to pass these names to the shell script variable.
and also i want to know the count... (4 Replies)
Discussion started by: Reddy482
4 Replies
2. Shell Programming and Scripting
Kindly i want to concatenate every 12 lines ina file, using a comma separator between fields (each line)?
can anyone help please?
thanks a lot in advance. (5 Replies)
Discussion started by: m_wassal
5 Replies
3. Shell Programming and Scripting
Hi,
I have a file with th elist of patches separated by comma, like below:
patch1, patch 2, patch 3................
t\The number of patches is not known as it changes every time.
I need assistance in writing a routine such as it will take patch1 as first variable and performs the... (4 Replies)
Discussion started by: avikaljain
4 Replies
4. Shell Programming and Scripting
Hi All,
I am facing issue, to read words in line, line as follow and i want to read word at each comma
1,you,are,two
So i want read like
1
you
are
two
Thanks (1 Reply)
Discussion started by: sujit_kashyap
1 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I have a large number of files which are written as csv (comma-separated values).
Does anyone know of simple sed/awk command do achieve this?
Thanks!
---------- Post updated at 10:59 AM ---------- Previous update was at 10:54 AM ----------
Guess I asked this too soon. Found the... (0 Replies)
Discussion started by: lost.identity
0 Replies
6. Shell Programming and Scripting
hello experts,
i am retrieving values in variables jobKey and jobName within my shell script. these values are returned to me within braces and i am using following command to remove those braces:
jobKeys=`echo $jobKeys | sed 's:^.\(.*\).$:\1:'`
jobNames=`echo $jobNames | sed... (1 Reply)
Discussion started by: avikaljain
1 Replies
7. Shell Programming and Scripting
Hi Everyone,
On my Linux box I have a text file having block of few lines and this block lines separated by one blank line. I would like to format and print these lines in such a way that this entire block of lines will come as single comma separated line & again next block of lines in next... (7 Replies)
Discussion started by: gr8_usk
7 Replies
8. Shell Programming and Scripting
I am trying to change a file that looks like this:
file, announcement,date, server, server01, server02, server06, file04, rec01, rec04, rec03... etc
into a vertical file like this:
file
announcement
date
server
server01
server02
server06
The file does not have to be sorted... (5 Replies)
Discussion started by: newbie2010
5 Replies
9. Shell Programming and Scripting
Hi All,
I'm trying to pass the comma separated values (string) returned from Plsql Procedure to UNIX variable.
getting the below log message
cat: -: Bad file descriptor
awk: cmd. line:1: fatal: error reading input file `-': Bad file descriptor
The output coming from plsql procedure is... (3 Replies)
Discussion started by: Mahesh3089
3 Replies
10. UNIX for Advanced & Expert Users
In Linux you can do this to put comma separated data on its own line like this.
sed 's/ */&\n/g' /tmp/ports
sed 's/ */\n/g' /tmp/ports
How do you do this in AIX? It is not working. Is there another way to do this? Something like this.
1, 2, 3, 4
To look like this.
1
2
3
4 (4 Replies)
Discussion started by: cokedude
4 Replies
Dt/Help.h(file formats) Dt/Help.h(file formats)
NAME
Dt/Help.h -- help services definitions
SYNOPSIS
#include <Dt/Help.h>
DESCRIPTION
The Dt/Help.h header defines the variables and function prototypes for help services.
The header defines the following DtHelpDialogCallbackStruct windowHint constants:
DtHELP_POPUP_WINDOW
DtHELP_CURRENT_WINDOW
DtHELP_NEW_WINDOW
The header defines the following DtHelpDialogCallbackStruct hyperType constants:
DtHELP_LINK_JUMP_NEW
DtHELP_LINK_TOPIC
DtHELP_LINK_MAN_PAGE
DtHELP_LINK_APP_DEFINE
DtHELP_LINK_TEXT_FILE
The header defines the following DtHelpDialogCallbackStruct reason constants:
DtCR_HELP_LINK_ACTIVATE
DtCR_HELP_CLOSE
DtCR_HELP_HELP
The header defines the following DtNScrollBarPolicy constants:
DtHELP_NO_SCROLLBARS
DtHELP_STATIC_SCROLLBARS
DtHELP_AS_NEEDED_SCROLLBARS
The header defines the following DtNhelpType constants:
DtHELP_TYPE_TOPIC
DtHELP_TYPE_STRING
DtHELP_TYPE_MAN_PAGE
DtHELP_TYPE_FILE
DtHELP_TYPE_DYNAMIC_STRING
The header defines the following DtNpaperSize constants:
DtHELP_PAPERSIZE_LETTER
DtHELP_PAPERSIZE_LEGAL
DtHELP_PAPERSIZE_EXECUTIVE
DtHELP_PAPERSIZE_A4
DtHELP_PAPERSIZE_B5
The header defines the following DtHelpQuickDialogGetChild constants:
DtHELP_QUICK_CLOSE_BUTTON
DtHELP_QUICK_PRINT_BUTTON
DtHELP_QUICK_HELP_BUTTON
DtHELP_QUICK_SEPARATOR
DtHELP_QUICK_MORE_BUTTON
DtHELP_QUICK_BACK_BUTTON
The header defines the following DtHelpReturnSelectedWidgetId constants:
DtHELP_SELECT_ERROR
DtHELP_SELECT_VALID
DtHELP_SELECT_ABORT
DtHELP_SELECT_INVALID
The header declares the following as functions:
void DtHelpSetCatalogName(char *catFile);
int DtHelpReturnSelectedWidgetId(Widget parent,
Cursor cursor,
Widget *widget);
SEE ALSO
Dt/HelpDialog.h - DtHelpDialog(5), Dt/HelpQuickD.h - DtHelpQuickD(5), DtCreateHelpQuickDialog(3), DtCreateHelpDialog(3), DtHelpSetCatalog-
Name(3), DtHelpReturnSelectedWidgetId(3), DtHelpDialog(3), DtHelpQuickDialog(3).
Dt/Help.h(file formats)