Unix iTOps Tube

Monday, May 14, 2012

Reformatting a list to table

Hi!



I have a list with a lot of records that I need to work with. The problem is that the list is populated successive one record at the time in a text file, and to gain anything from these records I need them to be put out in a table.



This is an example of what the list looks like:


Code:


(145) To: One From: Two Date: 21.03.2012

This is text

And so is this



(276) To: Three From: Two Date: 22.03.2012

This  is another text



(13) To: Two From: One Date: 22.03.2012

And so

is

this


What I would like is to have this text formatted like this:




Code:


(145) To: One From: Two Date: 21.03.2012;This is text;And so is this

(276) To: Three From: Two Date: 22.03.2012;This  is another text

(13) To: Two From: One Date: 22.03.2012;And so;is;this


As you can see, each record starts with (integer), and is followed by one or more lines of text. I have started on a bash script to do this, but I think I have a problem removing the newline-characters. :wall:



Does anyone have an idea of how I can fix this?




No comments:

Post a Comment