Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive

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

Re: Regular Expression Search and parse?

 Well... I mean, by code, no thats just confusing. You will have to program 
something, so pick your language and run with it. I would say for "ease" of 
use, sed/awk as they can be command line driven, grep I believe just is or 
was a specific command set in ed, now perhaps sed, that I may be mistaken 
on.... but in all ways you will have to program something, even a bash 
script, if you want it to run more then once. Honestly if you haven't done 
sed/awk programing before, and know a bit of perl... do it in perl, if you 
know a bit of python, do it in python, if you know sed or awk, use sed or 
awk... but in all forms programing will have to take place. ~Ben 

On Jan 18, 2008 8:51 AM, Grant M. <[hidden email]> wrote: 

> Mark Woodward wrote: 
> > So, if I have file with a lot of lines that look like this: 
> > 
> > Title: The Long and Winding Road [ISBN:123456] 
> > Descr: A boring book about boring roads 
> > Author: A dull cab driver 
> How about this: 
> # cat books.txt | grep '^Title\: ' | sed 's/.*\[//' | sed 's/\]//' 
> redirect that to an output file using " > isbns.txt" and you have your 
> ISBN numbers. If you just want the numbers, and not the "ISBN: ", then 
> change the first call to sed like this: sed 's/.*\[ISBN\://' 
> You could probably combine the last 2 seds, but this should do what you 
> asked. You could also make it some sort of alias with $1, $2, and $3 
> inputs, and do something like: 
> cat file | myreplacer '^Title\: ' 's/.*\[//' 's/\]//' > outfile.txt 
> Grant M. 
> -- 
> Grant Mongardi 
> Senior Systems Engineer 
> [hidden email] 
> 781.894.3114 phone 
> 781.894.3997 fax 
> NAPC | technology matters 
> -- 
> This message has been scanned for viruses and 
> dangerous content by MailScanner, and is 
> believed to be clean. 
> _______________________________________________ 
> Discuss mailing list 
> [hidden email] 

BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!

Boston Linux & Unix /