Quote:
Originally Posted by
nandugo1
well!!! the same code I have been using since long time...and it never showed this error....
I'm reminded of something from space history... On opening an electronic module for inspection: "My god, this part passed all our tests and it's *garbage*!" Just because it
works doesn't mean it's sensible. And if you use "for stuff in `cat file`" all over the place? You've suddenly got something to worry about.
The error's always been possible, but somehow you've never fed it lines with spaces before, and never fed it files larger than you can squeeze into a variable. You've been lucky.
Because $i wasn't quoted, your awk line ends up
awk -v token=India and Australia are world champions in cricket '{print token "\t" $0}' token gets the "india" part. The rest of it -- "and", "australia", "are", "world", "champions", "in", and "cricket" -- awk tries to run as scripts or read as files.
Quote:
I am executing this on diff flavour of unix.....let me know any other way
I just did. Try it, it should work. It should be able to handle files of any size too, where your version will barf on files bigger than a few kilobytes on some systems.