Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

awk metacharacters 1

Status
Not open for further replies.

goldenradium2001

Technical User
Mar 22, 2002
91
US
What is the difference between the *, +, and ? metacharacters in awk? I seem to receive the same output from all of these commands.

Any help will be appreciated!

Thanks!
 
* is zero or more of the previous character (or regexp)
+ is one or more of the previous character (or regexp)
? is zero or one of the previous character (or regexp)
CaKiwi
 
So, * and ? are not any different? What exactly does + do? I've seen those definitions on the Internet and every book I have but not really an example.

Here's my file:

Jean
Jeff
John
Josh
Jo

if I were to use J+, it would show all names. If I were to use J?, all names are displayed. And if I used J*, all names are displayed. Why have three different metacharacters if they do the same thing?

Any help? THanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top