Beginner Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherBeginner Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 18th, 2003, 12:15 PM
bensin bensin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 92 bensin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherBeginner Programming > help with simple bash/grep/sed


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT