-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 17 January 2003 15:03, Robert Land wrote: > grep '^1[0-9]\{1,\} \{1,\}K' phonelist.txt > or use * and repeat [0-9] and space: > grep '^1[0-9][0-9]* *K' phonelist.txt > " > > > =Why, in the first example, has the author > prefaced the char 'K' with the one or more > times multiplier? He only wants to find a > name beginning with 'K'(!) > > Then, in the snd grep command he doubled > '[0-9]', wouldn't only '^1[0-9]*....'be > sufficent? Again, 'K' is prefaced with the > asterisk which doesn't seem necessary to me.
It's searching for one or more space character, the asterisk is a "none or more" suffix for the preceding space. AFAIK there are no prefix multipliers in regexps. An equivalent notation would probably be '^1[0-9]+ +K' or, according to REGEX(7) '^1[:digit:]+ +K' (can't really use [:space:] since it would match newlines) or even better to also accept tabs as separator: '^1[:digit:]+[ \t]+K' but I'm not that good with POSIX/extended regexps. There _is_ a standard for that stuff, but it's weird enough to leave a lot of freedom. - -- Embedded Linux -- True multitasking! TWO TOASTS AT THE SAME TIME! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (GNU/Linux) iD8DBQE+KCIGeOF0+zcVdv8RAv1jAJ4xIgSiVbZ7HcYwBRWwpvtTL80NxACgl5IA cPoJU80L1pJBiPQ0b28AfoQ= =7sH1 -----END PGP SIGNATURE----- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]