Alex Barylo on Thu, 30 Nov 2000 12:20:16 -0500 (EST) |
> we all love grep and that's for a reason. however, > sometimes i wish to > scan a single line for a pattern and only get the > pattern back. simply > example: > > the pattern "[0-9]*" should return the string in the > second column > when applied to the string in the first column: > > aaaa9879aaaaaa0870aaaaaaaaaaa09 => 9879 0870 09 > aa908798986986aaaaaaaaaaaaaaaaa => 908798986986 If your pattern is simple enough that you easily can find an 'anti-pattern' for it, you can try this: grep '[0-9]' file | tr [:alpha:] ' ' | tr -s ' ' ' ' I don't remeber if tr can negate patterns, at least tr [^0-9] ' ' did not work. Alex. ===== Before the accident, I could not even spell UNIX __________________________________________________ Do You Yahoo!? Yahoo! Shopping - Thousands of Stores. Millions of Products. http://shopping.yahoo.com/ ______________________________________________________________________ Philadelphia Linux Users Group - http://www.phillylinux.org Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce General Discussion - http://lists.phillylinux.org/mail/listinfo/plug
|
|