Understand Awk Variables with 3 Practical Examples

2010-01-28 1 min read Learning Linux

<a id="aptureLink_gQhJKQ92Kn" style="padding: 0px 6px; float: left;" href="http://www.gnu.org/software/gawk/manual/gawk.html"><img style="border: 0px none;" title="The GNU Awk User's Guide" src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/ph/400x270_WebClip" alt="" width="400px" height="270px" />

<a id="aptureLink_CLV4LbC1Dr" style="padding: 0px 6px; float: right;" href="http://gnuwin32.sourceforge.net/packages/mawk.htm"><img style="border: 0px none;" title="Mawk for Windows" src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/ph/400x270_WebClip" alt="" width="400px" height="270px" /> This article is part of the on-going Awk Tutorial and Examples series. Like any other <a class="zem_slink freebase/en/programming_language" title="Programming language" rel="wikipedia" href="http://en.wikipedia.org/wiki/Programming_language">programming languages, Awk also has user defined variables and built-in variables. In this article let us review how to define and use <a class="zem_slink freebase/en/awk" title="AWK" rel="homepage" href="http://cm.bell-labs.com/cm/cs/awkbook/index.html">awk variables. Awk variables should begin with the letter, followed by it can consist of alpha numeric characters or underscore. Keywords […]

Continue reading

Display the output of a command from the first line until the first instance of a regular expression.

2010-01-04 0 min read Bash Linux
\"Screenshot
Image via Wikipedia

| perl -n -e 'print "$_" if 1 … /«a class="zem_slink freebase/en/regular_expression" title="Regular expression" rel="wikipedia" href="http://en.wikipedia.org/wiki/Regular_expression">regex>/;# This <a class="zem_slink freebase/en/command_line_interface" title="Command-line interface" rel="wikipedia" href="http://en.wikipedia.org/wiki/Command-line_interface">command line will display the output of , from the first line of output, until the first time it sees a <a class="zem_slink freebase/en/pattern_matching" title="Pattern matching" rel="wikipedia" href="http://en.wikipedia.org/wiki/Pattern_matching">pattern matching .

Continue reading
Newer posts