
July 18th, 2003, 12:15 PM
|
|
Contributing User
|
|
Join Date: May 2000
Posts: 92
Time spent in forums: 1 h 33 m 7 sec
Reputation Power: 9
|
|
|
help with simple bash/grep/sed
trying to create database entries from a dictionary...
example of existing dictionary format:
Word - 1. First definition. 2. Second definition.
Word2 - 1. First definition. 2. Second definition. 3. Third definition.
etc, etc...
I'm trying to limit myself to shell scripting to pull this off. I've already used sed to locate the '-' after the 'Word' (and ignore it anywhere else) and add a \n to wrap the first definition to a new line.
i.e.
Word -\n
1. First definition. 2. Second definition.
Now I want it to have it locate definitions 2-10 and wrap them to new lines as well. So far I can use grep to sniff out the format (grep -e "\. ['2'-'10']\. " dict) but then it returns the entire line and I can't insert a \n before the number.
i.e.
Word -\n
1. First definition.\n
2. Second definition.
Any ideas? How to set the actual value into a variable? Subroutines? thanks
|