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's and grep



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 02 September 2003 15:35, Derek Martin wrote:
> If the file contains more than one word per line (such as a dictionary
> with definitions), this won't work.  It can still be done, but you'd
> need a lot more logic.  AFAIK, there's no way to do that with a single
> regular expression, or even a simple pipeline.


In this case, I'd use sed to change the whitespaces into newlines:

cat file_with_multiple_words_per_line | sed -e 's/ /\n/g' | <grep exp>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/VPMWsIjNiQTGkXARAueTAJ4+uIwmQksix0XnYGnjyO3OvZ7MfQCfRVA+
8f/pOywKmsMR3Sknhmjr+4c=
=bi1h
-----END PGP SIGNATURE-----





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 / webmaster@blu.org