Page 1 of 1

File format help

Posted: 07 Mar 2013 02:58
by MrKnowItAllxx
I basically have this file:

Code: Select all

div style='width:1px;height:12px;' 
opalescence
opulent
paragon
pellucid
ominous
ostracize
perfunctory
peremptory
pariah
pall
obstreperous
parsimonious
olfactory
odious
obfuscate
ostentatious
obtrusive
opprobrium
parlance
pecuniary
penurious
nettle
obviate
overture
obdurate
a.
an outcast; a person generally despised or avoided
b.
not allowing contradiction or refusal
c.
cheap; stingy with money (think someone who is afraid to part with money)
d.
wealthy, rich, or affluent; exhibiting great wealth
e.
to irritate, annoy, or provoke
f.
an opening or initiating move toward negotiations, a new relationship, an agreement, etc.;
g.
to become distasteful or unpleasant
h.
hateful; detestable; disgusting
i.
having to do with the sense of smell
j.
threatening; menacing; a portent of evil or trouble
k.
a model of excellence (when compared, or placed beside, others)
l.
conversation
m.
to exclude, by general consent, from a group, society, friendship, organization, etc.; to banish
n.
lacking interest, care, or enthusiasm; approaching as only a routine duty
o.
clear in expression, meaning, or style; allowing much light to pass through
p.
showing off; wanting others to see
q.
noisy; unruly; resisting control
r.
hard-hearted; stubbornly wicked; harsh
s.
undesirably noticeable; thrusting out; something pushed on another person without their will or consent
t.
disgrace arising from extremely shameful conduct
u.
the reflection of a milky or pearly white
v.
to make confused; to muddle; to darken; to make obscure or hard to understand
w.
to anticipate and prevent or eliminate
x.
unwilling to spend money; cheap or stingy; poverty-stricken
y.
of or pertaining to money


But I need to format it like so:

Code: Select all

opalescence 
opulent
paragon
pellucid
ominous
ostracize
perfunctory
peremptory
pariah
pall
obstreperous
parsimonious
olfactory
odious
obfuscate
ostentatious
obtrusive
opprobrium
parlance
pecuniary
penurious
nettle
obviate
overture
obdurate

a.   an outcast; a person generally despised or avoided
b.   not allowing contradiction or refusal
c.   cheap; stingy with money (think someone who is afraid to part with money)
d.   wealthy, rich, or affluent; exhibiting great wealth
e.   to irritate, annoy, or provoke
f.   an opening or initiating move toward negotiations, a new relationship, an agreement, etc.;
g.   to become distasteful or unpleasant
h.   hateful; detestable; disgusting
i.   having to do with the sense of smell
j.   threatening; menacing; a portent of evil or trouble
k.   a model of excellence (when compared, or placed beside, others)
l.   conversation
m.   to exclude, by general consent, from a group, society, friendship, organization, etc.; to banish
n.   lacking interest, care, or enthusiasm; approaching as only a routine duty
o.   clear in expression, meaning, or style; allowing much light to pass through
p.   showing off; wanting others to see
q.   noisy; unruly; resisting control
r.   hard-hearted; stubbornly wicked; harsh
s.   undesirably noticeable; thrusting out; something pushed on another person without their will or consent
t.   disgrace arising from extremely shameful conduct
u.   the reflection of a milky or pearly white
v.   to make confused; to muddle; to darken; to make obscure or hard to understand
w.   to anticipate and prevent or eliminate
x.   unwilling to spend money; cheap or stingy; poverty-stricken
y.   of or pertaining to money


I don't really know how to go about doing this, any help is appreciated. Also note - the white spaces after the '.' characters need to be tab characters

Re: File format help

Posted: 07 Mar 2013 06:42
by foxidrive
file.txt is the input file. fileout.txt is the output file.

The characters after !wait! should be TABS

Code: Select all

@echo off
setlocal EnableDelayedExpansion
for /f "skip=1 delims=" %%a in (file.txt) do (
if defined wait (
>>fileout.txt echo !wait!   %%a
set wait=
) else (
set "var=%%a"
if "!var:~1,1!"=="." (set wait=%%a) else (>>fileout.txt echo %%a)
)
)