Text to csv


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Text to csv
# 1  
Old 04-27-2009
Text to csv

Hi,

I have a document with a lot of data, it is structured like this,

Code:
UNIQUESTRING


To be acquited of a crime is to be deemed to be innocent of
the charges after a court hearing. This is different from a
<a href=lawglos_Discharge.html>Discharge</a>, where the case is never heard. In
general, a defendant who is acquited can not be tried again
for the same offence. If more than one defendant is on
trial for the same offence (see: <a href=lawglos_Accomplice.html>Accomplice</a>),
the acquital of one of them is not admissible as evidence
in favour of the others. A conviction, however, is
admissible against the other defendants. This is because an
acquital is not `proof' of innocence, it is merely an
indication that the prosecution did not establish a case
strong enough for a conviction. In other words, `innocent
until proven guilty' does not mean that `all are innocent
until all are proven guilty'. 
<p>
<a href=lawglos_CriminalLaw.html>CriminalLaw</a>


UNIQUESTRING


`blameworthy act'; it is used to denote the event on which a criminal offence
is based. In many
cases the <i>actus reus</i> will be an explicit act (theft, 
assault, etc). In others it will be a prohibited state
of affairs (e.g., having an offensive 
weapon (see: <a href=lawglos_OffensiveWeapon.html>OffensiveWeapon</a>) 
in a public place). In some cases the <i>actus</i> can be
an omission to act (see: <a href=lawglos_Omission.html>Omission</a>), but usually only when the
those offences the prosecution has no duty to show
a <i>mens rea</i> (see: <a href=lawglos_MensRea.html>MensRea</a>); thus an offence cannot
be defended on the basis that there was no intention to
comment the offence, but it can be defended on the basis
that no offence was committed.
<p>
<p>
This defence will only be available if the defendant truly
had <i>no</i> choice; for example, he was physically 
pushed by someone else. A defendant who makes a choice
between two equally dreadful alternatives (`help us rob
this bank or we'll shoot your wife') is not acting
involuntarily in this sense, but he may have a 
<a href=lawglos_GeneralDefence.html>GeneralDefence</a> of <a href=lawglos_Duress.html>Duress</a>.
<p>
<a href=lawglos_CriminalLaw.html>CriminalLaw</a>


UNIQUESTRING


As defined in the <a href=lawglos_TheftAct1968.html>TheftAct1968</a>, a <a href=lawglos_Burglary.html>Burglary</a> in which 
the perpetrator has an offensive weapon (see: <a href=lawglos_OffensiveWeapon.html>OffensiveWeapon</a>).
This Act defines an offensive weapon as something that is
<i>intended</i> to cause harm.
<p>
<a href=lawglos_CriminalLaw.html>CriminalLaw</a>


UNIQUESTRING

And it goes on forever, I need to put all these short definitions into a database, in excel I have all keywords in a long list in one column A1,A2,A3 etc and now I like to place these definitions next to them B1,B2,B3 etc

Can someone please tel me how to make that happen? I tried to import using excel and do table to column but that doesn't work, I am sure with unix it is easier..
# 2  
Old 04-28-2009
Access might be a better choice of "database", but you can do it in excel too (but very large columns become unwieldy).

What I'm not clear about is this: how do you propose to know which thing is being defined? Is it the UNIQUESTRING?

IF the UNIQUESTRING is static (does not change within one file), then using awk, you can do something like this:
Code:
awk 'BEGIN { OFS="\t"; RS="\n*UNIQUESTRING\n\n*" } { gsub(/ \n/," "); gsub(/\n/," "); print $0; }'

Each paragraph will appear on one line. Again, how do you correlate that to terms?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert text to csv

Hi, Is there somebody there to post an idea on how to convert this 5 liner row to 1 liner or tab delimiter to be import to database. Here the text file format: Description: Description1 Link: https://www.google.com Date: June 2, 2018 Time: 00:07:44 Age: 1 days ago Description:... (2 Replies)
Discussion started by: lxdorney
2 Replies

2. Shell Programming and Scripting

CSV from Text file

Gents, Attached there is a input.txt and code.txt file. I use that code to create a csv file from txt file. Is there the possibility to generate other code more faster to generate the CVS file using the input file. I have deleted many data in the input file to avoid load a lot data. ... (10 Replies)
Discussion started by: jiam912
10 Replies

3. Shell Programming and Scripting

Create csv from text file

Gents, I am trying to create a csv file using the file attached. I have a problem to get all information required because the rows are not continues. Here is my code till now. awk ' /"ffid"/{if(s){print s;s=$NF}else{s=$NF}} /"LineNumber"/{s=s $NF} /"PointNumber"/{s=s $NF}... (4 Replies)
Discussion started by: jiam912
4 Replies

4. Shell Programming and Scripting

TEXT to CSV using Perl

Hi Folks Need some help with this and my Perl isnt the hottest I also have text::csv installed on my perl install The large text with a few million entries is in a format below example text file Fig Leafs Cake No: 0000001 Author: King s. Record No: 995-34343-232-232... (5 Replies)
Discussion started by: messiah1
5 Replies

5. Shell Programming and Scripting

Convert text to CSV

Hi Gurus I need urgent help to convert a flat log file into csv format to load into database. Log looks like: a=1 b=2 c=3 a=4 b=5 c=6 Only the values at right side of = will come into csv and it should create a new line once it receives "a" field. (8 Replies)
Discussion started by: sandipjee
8 Replies

6. Shell Programming and Scripting

text to csv conversion

Thank u every body ......just need a help so that a text file needs to be converted into CSV............. my log file is as follows Host scsi3: usb-storage Vendor: Maxtor Product: OneTouch III Serial Number: 044303E5 Protocol: Transparent SCSI Transport: Bulk ... (4 Replies)
Discussion started by: tangotango
4 Replies

7. Shell Programming and Scripting

Can't use Text::CSV... any sample code out there?

I was looking at a library that lets me parse comma delimited csv files without a problem, but unfortunately, I'm not allowed to make use of that library. I understand that the library probably does something similar to a string split(), but I don't quite know what kind of regular expression is... (1 Reply)
Discussion started by: mrwatkin
1 Replies

8. Shell Programming and Scripting

Text to CSV

Hi, My access log looks like this... 192.168.50.184 - - "GET /ATIM_LATEST/ABC/ HTTP/1.1" 200 522 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13" 192.168.50.184 - - "GET /ATIM_LATEST/ABC/ATIM/syncdepot.php HTTP/1.1" 200 1463... (5 Replies)
Discussion started by: shantanuo
5 Replies

9. UNIX for Advanced & Expert Users

how to convert text/csv to excel

Hello All, I have a sql report with 50 columns and 1000 rows result in a file ( txt / csv). is there is any way that we can move them to excel in KSH. Thanks, Sateesh (7 Replies)
Discussion started by: kotasateesh
7 Replies

10. Shell Programming and Scripting

converting text to csv format

I am trying to check each line and based on first two digits, the comma needs to be place. I checked in the earlier post where the text is converted to csv with a tab delimited. Here is the test file that needs to be changed to csv 11 051701 22 051701 330123405170105170112345... (13 Replies)
Discussion started by: gthokala
13 Replies
Login or Register to Ask a Question