What does this mean?
[please do not top post]
It's not testing whether the 2nd and 4th characters are E; it is
checking whether the 2nd character is E and the 4th character is
(.
Try it and see:
printf "WER(TY)" "QWERTY" |
awk '
/^.E.\(/ { print "1" }
!/^.E.\(/ { printf " %s\n", $0 } '
It prints the line ($0) preceded by a space:
printf " %s\n", $0
It's a "regular expression". If you are going to use awk, you
need at least a basic understanding of how they work.
The awk man page has the basics, and the book, "The AWK
Programming Language", is a good introduction. You can also find
links to web pages on awk and regular expressions on my shell
page: <http://cfaj.freeshell.org/shell>.
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
|