Re: What does this do?



On 2006-05-17, cyber citizen wrote:
Hi any pointers on what is happening here?

awk '(\$2 == \"T\") || (\$2 == \"B\") { sym = \$3; sub(/^_*/, \"\", sym); print sym}' > <temp_file>

Executing this is giving the following error:

awk: cmd. line:1: (\$2 == \"T\") || (\$2 == \"B\") { sym = \$3; sub(/^_*/, \"\", sym); print sym}
awk: cmd. line:1: ^ backslash not last character on line

Read the error message. Note that it tells you what command is
producing the error.

What command does awk see?

What do you want awk to see?

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
.



Relevant Pages

  • Re: Removing lines from a plain text file
    ... Apparently there is no simple command. ... > and put prune in a cron job. ... > size by removing the excess from the beginning of the file. ... date from the past and use awk to search through the file for it and discard ...
    (comp.unix.sco.misc)
  • Re: Closing a field
    ... I thought of the same solution, that of using the field number count as the discriminant, mainly because I don't have any idea how to use AWK to validate a field as a number. ... The treatment of tabs as an alias for spaces in some POSIX is motivating me to stay away from them. ... already have a filter called 'join' so why not use AWK to create a filter called 'select' and for other SQL commands as well. ... I'd want to call the script by its SQL command name and use it as an SQL-like Unix pipe filter. ...
    (comp.lang.awk)
  • Re: Problem while executing "system " in awk
    ... There is a file(named myno) containg phone numbers. ... I've written following awk prog ... Please suggest why my systemcommand is not executing ... it is possible that the shell is seeing your command as ...
    (comp.lang.awk)
  • Re: Newbie Scripting Variable Question
    ... A lot of scripters use the single back quotes to indicate a command ... The cal is evauated, the output used as input for awk, and then the awk ... is the Korn Shell by David Korn. ... # typeset -Z2 abc ...
    (comp.unix.aix)
  • Re: Interesting math
    ... One thing I've learned is that it's often a superior language for ... And if you want to do build up a command line, ... Write the script in Perl instead, and all these problems just go away. ... anything you could do from a C program, or an awk program for that matter. ...
    (alt.usage.english)