problem while comparing awk field variable with input variable entered using keyboard
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Please use [code][/code] tags around your code, to preserve formatting and to improve readability.
Shell variables are NOT awk variables! They may look the same at first glance, but awk uses a separate variable system with a slightly different syntax.
You have to import the bash variable into an awk variable before you can use it. (It's also possible by using careful quoting of the awk expression to allow shell expansion, but it's usually better to import it.
awk:syntax error near line 1
awk:bailing out error near line 1
can you please suggest the same above code in SOLARIS
Just a comment about awk and Solaris.
On Solaris 10 and older, /usr/bin/awk is a legacy binary that doesn't comply with standard awk. It is there only to maintain compatibility with old scripts that might still stay around.
For new scripts, you should always use /usr/bin/nawk (for new awk) instead. nawk is faster and complies with POSIX awk. For pure standard compliance, you might also use /usr/xpg4/bin/awk. If you are using Gnu specific extensions, you should instead run something like /usr/sfw/bin/gawk, /usr/local/bin/gawk, /opt/csw/bin/gawk, /usr/gnu/awk, or somewhere else depending on the Solaris release and optional packages possibly installed.