[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Sed & Awk

Sorry, I dont know if this is the right group, but here goes anyway.

I have a text file containing a document (eg this posting) which is
formatted as such.  I need to import this into a database, and so I
need to format the text to do this.
I want the text to be 'cut' every 300 or so characters, and then
create a flat file from this, with line numbers.
"1","blah blah bla"   # (300 characters of blah)
"2","h blah blah b"   # (and again)

I need to get rid of the carriage returns, and it would be preferable
to get rid of the too much whitespace.

Does anyone have any ideas as to how I can go about this?
The only thing I can do so far is stick the text into a single line,
and 'split -b300', and then I 'more * >'.  And then I am stuck. 
(clearly a bad plan anyway!)

Does anyone have any ideas?  Thanks,

Reply to: