User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,555 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,492 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums

Quick question about text processing

Join Date: Apr 2006
Posts: 140
Reputation: ghostdog74 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 26
ghostdog74 ghostdog74 is offline Offline
Junior Poster

Re: Quick question about text processing

  #3  
Jan 27th, 2007
Originally Posted by Mushy-pea View Post
Could someone tell me the kind of commands I need to research to do stuff with text like this? I can work out the rest. Any help appriciated.

Tools such as sed/awk/perl are used for text processing. they make use of regular expressions alot. So you need to research on how regular expressions work. Text processing can also be done without regular expressions. If you have Python on your machine, here's a simple way to do what you want.
indices=[] #define array list to keep "~" indexes
s = "Here's some text and ~this bit gets removed~, where tilda is the delimiter."
for num,ch in enumerate(s):
 	if ch == "~":
 		indices.append(num)
s = list(s) #turn s into a list, so we can make changes to it
del s[indices[0]: indices[1]+1] 
print ''join(s)
Reply With Quote  
All times are GMT -4. The time now is 5:26 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC