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
LEARN ABOUT OPENSOLARIS
ne_set_request_expect100
NE_SET_REQUEST_E(3) neon API reference NE_SET_REQUEST_E(3)
NAME
ne_set_request_expect100 - function to enable Expect: 100-continue support
SYNOPSIS
#include <ne_request.h>
void ne_set_request_expect100 (ne_request *request, int flag);
DESCRIPTION
An extension introduced in the HTTP/1.1 specification was the use of the Expect: 100-continue header. This header allows an HTTP client to
be informed of the expected response status before the request message body is sent: a useful optimisation for situations where a large
message body is to be sent. The ne_set_request_expect100 function can be used to enable this feature by passing the flag parameter as any
non-zero integer.
Warning
Unfortunately, if this header is sent to a server which is not fully compliant with the HTTP/1.1 specification, a deadlock occurs
resulting in a temporarily "hung" connection. neon will recover gracefully from this situation, but only after a 15 second timeout.
It is highly recommended that this option is not enabled unless it is known that the server in use correctly implements Expect:
100-continue support.
SEE ALSO
ne_request_create(3).
AUTHOR
Joe Orton <neon@webdav.org>.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Availability | SUNWneon |
+--------------------+-----------------+
|Interface Stability | Volatile |
+--------------------+-----------------+
NOTES
Source for Neon is available on http://opensolaris.org.
neon 0.25.5 20 January 2006 NE_SET_REQUEST_E(3)