
Another approach to working with "awk"
A reader writes in with the following note:
I've just picked up your book Wicked Cool Shell Scripts, and there are a lot of nifty things in it. I too have accumulated a lot of things generally in small scripts or more frequently in bourne/bash functions. I was particularly tickled to see a lot of very similar code, one such that jumped out at me was your gmk function in one script (I called mine kmg). What I'm getting is the last field if and only if it's prefaced by a space, whereas you're ignoring the leading space and looking just to see if the last field matches "$1". Where might this differ? When the output is a single word on a line by itself: with your conditional it could match, whereas with mine it couldn't. Nonetheless, I am happy to hear about smarter and more logical ways to solve problems that I talk about in my book, so please do feel free to send any further thoughts in!
Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon
Categorized:
Shell Script Programming
(Article 3729)
Tagged: Previous: Where's this NotePad application? Next: What's Acceptable Search Engine "Spam" Technique? Subscribe!
Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.
Rather amazingly, there are no comments on this article yet.
I have a lot to say, but ...
I do have a comment, now that you mention it!
|
![]()
Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.
Help!
Subscribe to
Ask Dave Taylor!
Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.
Articles and Reviews
Auctions and Online Shopping Blogs and RSS Feeds Building Web site traffic Business and Management Cell Phones and Mobile Phones CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above HTML and CSS Mac OS X Help MySpace, Facebook, Twitter and Social Network Help Pay Per Click (PPC) Search Engine Optimization Shell Script Programming Sony PSP, MP3 Players, Etc. The Writing Business Unix and Linux Help Video Game Tips and Help Windows Help
Recent Entries
Join the List!
Book Links
|