I need to analyse a txt document with thousands of rows, but I'm having trouble splitting the data into spaces because there are spaces enclosed in double quotation marks and square brackets that should not be considered. How could I do this?

I am using this code:

```
from pyspark import SparkContext
sc = SparkContext.getOrCreate()
lines = sc.textFile('C:\\test.txt')
parts = lines.map(lambda line: line.replace(' - - ', ' ').split(' '))
print(parts.glom().collect())

```

The first row is:

> 
> 199.72.81.55 - - [01/Jul/1995:00:00:01 -0400] "GET /history/apollo/ HTTP/1.0" 200 6245
> 
> 
> 

And the output is:

> 
> ['199.72.81.55', '[01/Jul/1995:00:00:01', '-0400]', '"GET',
>  '/history/apollo/', 'HTTP/1.0"', '200', '6245']
> 
> 
> 

But should be:

> 
> ['199.72.81.55', '[01/Jul/1995:00:00:01 -0400]', '"GET
>  /history/apollo/ HTTP/1.0"', '200', '6245']
> 
> 
> 

I'm starting to learn Spark and I'm kind of lost. I've tried everything and I can not solve this problem.

Thank you!