<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Related items]]></title>
	<link>https://bioinformaticsonline.com/related/43431?offset=10</link>
	<atom:link href="https://bioinformaticsonline.com/related/43431?offset=10" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/bookmarks/view/44622/variant-calling-resequencing-based-genome-inference</guid>
	<pubDate>Wed, 31 Jul 2024 02:02:24 -0500</pubDate>
	<link>https://bioinformaticsonline.com/bookmarks/view/44622/variant-calling-resequencing-based-genome-inference</link>
	<title><![CDATA[Variant Calling Resequencing-Based Genome Inference]]></title>
	<description><![CDATA[<p>Variant Calling - Resequencing-Based Genome Inference</p>
<p>Erik Garrison<br>University of Tennessee Health Science Center<br>Workshop on Genomics - Česk&yacute; Krumlov<br>January 12, 2024</p>
<p>https://evomics.org/wp-content/uploads/2024/01/Variant-calling-Workshop-on-Genomics-2024-Cesky-Krumlov.pdf</p><p>Address of the bookmark: <a href="https://evomics.org/wp-content/uploads/2024/01/Variant-calling-Workshop-on-Genomics-2024-Cesky-Krumlov.pdf" rel="nofollow">https://evomics.org/wp-content/uploads/2024/01/Variant-calling-Workshop-on-Genomics-2024-Cesky-Krumlov.pdf</a></p>]]></description>
	<dc:creator>Abhi</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/pages/view/36603/learning-python-programming-a-bioinformatician-perspective</guid>
	<pubDate>Mon, 14 May 2018 16:33:03 -0500</pubDate>
	<link>https://bioinformaticsonline.com/pages/view/36603/learning-python-programming-a-bioinformatician-perspective</link>
	<title><![CDATA[Learning Python Programming - a bioinformatician perspective !]]></title>
	<description><![CDATA[<p>Python Programming&nbsp;is a general purpose programming language that is open source, flexible, powerful and easy to use. One of the most important features of python is its rich set of utilities and libraries for data processing and analytics tasks. In the current era of big biological data, python and biopython is getting more popularity due to its easy-to-use features which supports big data processing.</p><p>In this tutorial series article, I will explore features and packages of python which are widely used in the big data, NGS, and bioinformatics. I will also walk through a real biological example which shows NGS data processing with the help of python packages and programming.</p><p>Python has a couple of points to recommend it to biologists and scientists specifically:</p><ul>
<li>It's widely used in the scientific community</li>
<li>It has a couple of very well designed libraries for doing complex scientific computing (although we won't encounter them in this book)</li>
<li>It lend itself well to being integrated with other, existing tools</li>
<li>It has features which make it easy to manipulate strings of characters (for example, strings of DNA bases and protein amino acid residues, which we as biologists are particularly fond of)</li>
</ul><p>In general, following are some of the important features of python which makes it a perfect fit for rapid application development.</p><ul>
<li>Python is interpreted language so the program does not need to be compiled. Interpreter parses the program code and generates the output.</li>
<li>Python is dynamically typed, so the variables types are defined automatically.</li>
<li>Python is strongly typed. So the developers need to cast the type manually.</li>
<li>Less code and more use makes it more acceptable.</li>
<li>Python is portable, extendable and scalable.</li>
</ul><p>There are two major Python versions, Python 2 and Python 3. Python 2 and 3 are quite different. This tutorial uses Python 3, because it more semantically correct and supports newer features.</p><p>I will post tutorial on daily basis on this page. Check the sub-pages on right side.</p>]]></description>
	<dc:creator>Rahul Nayak</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/bookmarks/view/43243/interactive-bioinformatics-resources</guid>
	<pubDate>Thu, 12 Aug 2021 00:09:00 -0500</pubDate>
	<link>https://bioinformaticsonline.com/bookmarks/view/43243/interactive-bioinformatics-resources</link>
	<title><![CDATA[Interactive Bioinformatics Resources !]]></title>
	<description><![CDATA[<p>Learn how to use bioinformatics tools right from your browser.<br>Everything runs in a sandbox, so you can experiment all you want.</p>
<p>More at sandbox.bio</p><p>Address of the bookmark: <a href="http://sandbox.bio" rel="nofollow">http://sandbox.bio</a></p>]]></description>
	<dc:creator>Jit</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/bookmarks/view/43631/pangolin-tutorial</guid>
	<pubDate>Fri, 10 Dec 2021 05:58:59 -0600</pubDate>
	<link>https://bioinformaticsonline.com/bookmarks/view/43631/pangolin-tutorial</link>
	<title><![CDATA[Pangolin tutorial !]]></title>
	<description><![CDATA[<p><span>This is a tutorial for using the Pangolin Web Application. For information on using the command line tool, please visit the&nbsp;</span><a href="https://cov-lineages.org/resources/pangolin/usage.html">command line tool usage page</a><span>.</span></p>
<p>https://cov-lineages.org/resources/pangolin/tutorial.html</p><p>Address of the bookmark: <a href="https://cov-lineages.org/resources/pangolin/tutorial.html" rel="nofollow">https://cov-lineages.org/resources/pangolin/tutorial.html</a></p>]]></description>
	<dc:creator>Abhi</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/bookmarks/view/44601/free-resources-to-learn-statistics</guid>
	<pubDate>Sat, 06 Jul 2024 10:30:50 -0500</pubDate>
	<link>https://bioinformaticsonline.com/bookmarks/view/44601/free-resources-to-learn-statistics</link>
	<title><![CDATA[Free resources to learn statistics]]></title>
	<description><![CDATA[<p><span>Welcome to the course notes for&nbsp;</span><span>STAT 414: Introduction to Probability Theory</span><span>. These notes are designed and developed by Penn State's&nbsp;</span><a href="https://science.psu.edu/stat">Department of Statistics</a><span>&nbsp;and offered as open educational resources. These notes are free to use under Creative Commons license&nbsp;</span><a href="https://creativecommons.org/licenses/by-nc/4.0/">CC BY-NC 4.0</a><span>.</span></p>
<p>&nbsp;</p>
<p>A free online version of the second edition of the book based on Stat 110,&nbsp;<em>Introduction to Probability</em>&nbsp;by Joe Blitzstein and Jessica Hwang,&nbsp;is now available at&nbsp;<a href="http://probabilitybook.net/" title="http://probabilitybook.net">http://probabilitybook.net</a></p>
<p>Print copies are available via&nbsp;<a href="https://www.crcpress.com/Introduction-to-Probability-Second-Edition/Blitzstein-Hwang/p/book/9781138369917" title="">CRC Press</a>,&nbsp;<a href="https://amzn.to/2Ubh7D8" title="">Amazon</a>, and elsewhere.&nbsp;</p>
<p>Stat110x is also available as an&nbsp;edX course.&nbsp;Free signup at&nbsp;<a href="https://www.edx.org/course/introduction-to-probability-0" title="https://www.edx.org/course/introduction-to-probability-0">https://www.edx.org/course/introduction-to-probability-0</a></p>
<p>The edX course focuses on animations, interactive features, readings, and problem-solving, and&nbsp;is&nbsp;<strong>complementary</strong>&nbsp;to the Stat 110 lecture videos on YouTube, which are available at&nbsp;<a href="https://goo.gl/i7njSb" title="https://goo.gl/i7njSb">https://goo.gl/i7njSb</a></p>
<p>The Stat110x animations are available within the course and at&nbsp;<a href="https://goo.gl/g7pqTo" title="">https://goo.gl/g7pqTo</a></p>
<p><a href="https://projects.iq.harvard.edu/stat110/home">https://projects.iq.harvard.edu/stat110/home</a>&nbsp;</p><p>Address of the bookmark: <a href="https://online.stat.psu.edu/stat414/" rel="nofollow">https://online.stat.psu.edu/stat414/</a></p>]]></description>
	<dc:creator>BioStar</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/news/view/19272/translate2r</guid>
	<pubDate>Fri, 21 Nov 2014 01:16:06 -0600</pubDate>
	<link>https://bioinformaticsonline.com/news/view/19272/translate2r</link>
	<title><![CDATA[translate2R]]></title>
	<description><![CDATA[<p>After their presentation at the international &ldquo;user!&rdquo; conference, data analysis specialist <a href="http://www.eoda.de/en/" target="_blank">eoda</a> starts the public alpha testing of <a href="http://www.eoda.de/en/translate2R.html" target="_blank">translate2R</a>. With the start of alpha testing the innovative migration solution by the company hailing from Kassel discards the working title &ldquo;translateR&rdquo; and takes on the final product brand name &ldquo;translate2R&rdquo;. translate2R is a service for the automated translation of SPSS&reg; syntax to R code, therefore supporting data analysts with a quick and low-risk migration to R.</p><p>The manual translation of many, frequently rather complex SPSS scripts often presents itself as a tedious and error-prone task, and represents a rather large obstacle for many analysts and companies to migrate to a modern, open source data management and analysis tool like R. With translate2R this hurdle will be diminished substantially.</p><p>Find at https://service.eoda.de/translater/?lang=en</p>]]></description>
	<dc:creator>Rahul Nayak</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/blog/view/44746/cracking-the-code-a-guide-to-bioinformatics-job-hunting</guid>
	<pubDate>Mon, 23 Dec 2024 19:36:41 -0600</pubDate>
	<link>https://bioinformaticsonline.com/blog/view/44746/cracking-the-code-a-guide-to-bioinformatics-job-hunting</link>
	<title><![CDATA[Cracking the Code: A Guide to Bioinformatics Job Hunting]]></title>
	<description><![CDATA[<p>Entering the world of bioinformatics is an exciting journey, filled with opportunities to combine biology, data science, and technology to address some of the most pressing scientific challenges. However, securing a position in this competitive field can be daunting, especially for newcomers. Here&rsquo;s a guide to help you navigate the job-hunting process and land your dream role in bioinformatics.</p><h4>1. <strong>Understand the Landscape</strong></h4><p>Before diving into applications, take the time to understand the bioinformatics job market. Common roles include:</p><ul>
<li><strong>Bioinformatics Analyst/Scientist:</strong> Focused on data analysis and interpretation.</li>
<li><strong>Computational Biologist:</strong> Combines computational techniques with biological research.</li>
<li><strong>Data Scientist in Genomics:</strong> Applies machine learning and statistical models to genomic data.</li>
<li><strong>Software Developer in Bioinformatics:</strong> Designs and develops tools and pipelines for biological research.</li>
</ul><p>Familiarize yourself with the key industries hiring bioinformaticians, such as academia, biotech, pharmaceuticals, healthcare, and agriculture.</p><h4>2. <strong>Build a Strong Foundation</strong></h4><p>Bioinformatics demands a diverse skill set. Ensure you have a solid foundation in the following areas:</p><ul>
<li><strong>Programming Skills:</strong> Proficiency in Python, R, or Perl is often required. Familiarity with tools like Bash scripting and version control systems (e.g., Git) is a plus.</li>
<li><strong>Statistics and Data Analysis:</strong> Knowledge of statistical methods, machine learning, and data visualization is crucial.</li>
<li><strong>Biological Knowledge:</strong> Understanding genomics, transcriptomics, and proteomics will help you communicate effectively with biologists.</li>
<li><strong>Specialized Tools and Databases:</strong> Be comfortable using tools like BLAST, Bowtie, and databases like NCBI and Ensembl.</li>
</ul><h4>3. <strong>Create a Winning Resume and Portfolio</strong></h4><p>Highlight your technical skills, biological knowledge, and relevant experience. Tips for a standout application:</p><ul>
<li>Tailor your resume to each job, emphasizing skills mentioned in the job description.</li>
<li>Showcase your experience with real-world datasets by linking to your GitHub profile or online portfolio.</li>
<li>Include details of any publications, presentations, or significant projects.</li>
</ul><h4>4. <strong>Network Actively</strong></h4><p>Networking is often the key to discovering opportunities. Here&rsquo;s how to build connections:</p><ul>
<li><strong>Attend Conferences and Workshops:</strong> Events like ISMB or specialized bioinformatics workshops are great for meeting professionals.</li>
<li><strong>Engage Online:</strong> Join LinkedIn groups, participate in bioinformatics forums, and follow relevant hashtags on Twitter.</li>
<li><strong>Leverage Alumni Networks:</strong> Connect with alumni from your university who are working in the field.</li>
</ul><h4>5. <strong>Gain Relevant Experience</strong></h4><p>Experience is a major factor for hiring managers. Ways to enhance your profile include:</p><ul>
<li><strong>Internships:</strong> Seek out internships in research labs or biotech companies.</li>
<li><strong>Collaborations:</strong> Volunteer to work on projects with professors or peers.</li>
<li><strong>Open Source Contributions:</strong> Participate in bioinformatics software development on platforms like GitHub.</li>
</ul><h4>6. <strong>Prepare for Interviews</strong></h4><p>Bioinformatics interviews often combine technical and behavioral questions. Prepare by:</p><ul>
<li><strong>Reviewing Key Concepts:</strong> Refresh your knowledge of algorithms, sequence analysis, and statistical methods.</li>
<li><strong>Practicing Coding:</strong> Be ready to solve coding challenges or discuss code snippets.</li>
<li><strong>Understanding the Organization:</strong> Research their recent projects, publications, or products.</li>
<li><strong>Preparing Questions:</strong> Demonstrate interest by asking about their tools, workflows, or team structure.</li>
</ul><h4>7. <strong>Stay Resilient and Persistent</strong></h4><p>Job hunting can be a long process, but persistence pays off. Tips to keep moving forward:</p><ul>
<li>Keep improving your skills by taking online courses or certifications.</li>
<li>Stay updated with advancements in bioinformatics by following journals and blogs.</li>
<li>Apply to multiple positions and don&rsquo;t get discouraged by rejections. Each application is a learning experience.</li>
</ul><h3>Closing Thoughts</h3><p>Landing a bioinformatics job requires a mix of technical expertise, networking, and resilience. By understanding the market, showcasing your skills effectively, and continuously learning, you&rsquo;ll be well on your way to a rewarding career in this dynamic field. Remember, the key to cracking the code is perseverance&mdash;stay curious, stay determined, and success will follow.</p>]]></description>
	<dc:creator>Abhi</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/videolist/watch/14218/pimp-your-brain-bioinformatics</guid>
	<pubDate>Wed, 20 Aug 2014 22:09:21 -0500</pubDate>
	<link>https://bioinformaticsonline.com/videolist/watch/14218/pimp-your-brain-bioinformatics</link>
	<title><![CDATA[Pimp your brain: Bioinformatics]]></title>
	<description><![CDATA[<iframe width="" height="" src="https://www.youtube-nocookie.com/embed/KqelGy6Q8nE" frameborder="0" allowfullscreen></iframe>Jan Lisec from the Max Planck Institute of Molecular Plant Physiology explains, in this "pimp your brain" episode, what bioinformatics is and why bioinformatics is so important and indispensable for biological research.

In the video serial "Pimp your brain" scientists from the Max Planck Institute of Molecular Plant Physiology describe their research. More videos from the 'Pimp your brain' serial are available on www.youtube.com/playlist?list=PL-l9VItC9Gn2Ur2Xj6PTOAkjLUlVPbIOO

More videos are available on www.mpimp-golm.mpg.de]]></description>
	
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/bookmarks/view/33398/tiny-python36-notebook</guid>
	<pubDate>Sat, 03 Jun 2017 03:16:28 -0500</pubDate>
	<link>https://bioinformaticsonline.com/bookmarks/view/33398/tiny-python36-notebook</link>
	<title><![CDATA[Tiny Python3.6 Notebook]]></title>
	<description><![CDATA[<p><span>This is not so much an instructional manual, but rather notes, tables, and examples for Python syntax. It was created by the author as an additional resource during training, meant to be distributed as a physical notebook. Participants (who favor the physical characteristics of dead tree material) could add their own notes, thoughts, and have a valuable reference of curated examples.</span></p><p>Address of the bookmark: <a href="https://github.com/mattharrison/Tiny-Python-3.6-Notebook/blob/master/python.rst" rel="nofollow">https://github.com/mattharrison/Tiny-Python-3.6-Notebook/blob/master/python.rst</a></p>]]></description>
	<dc:creator>Neel</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/blog/view/39307/awk-for-beginners</guid>
	<pubDate>Fri, 26 Apr 2019 16:19:41 -0500</pubDate>
	<link>https://bioinformaticsonline.com/blog/view/39307/awk-for-beginners</link>
	<title><![CDATA[AWK for beginners !]]></title>
	<description><![CDATA[<p>AWK is a standard tool on every POSIX-compliant UNIX system. It&rsquo;s like flex/lex, from the command-line, perfect for text-processing tasks and other scripting needs. It has a C-like syntax, but without mandatory semicolons (although, you should use them anyway, because they are required when you&rsquo;re writing one-liners, something AWK excels at), manual memory management, or static typing. It excels at text processing. You can call to it from a shell script, or you can use it as a stand-alone scripting language.</p><p>Why use AWK instead of Perl? Readability. AWK is easier to read than Perl. For simple text-processing scripts, particularly ones that read files line by line and split on delimiters, AWK is probably the right tool for the job.</p><div><pre><span>#!/usr/bin/awk -f</span>

<span># Comments are like this</span>


<span># AWK programs consist of a collection of patterns and actions.</span>
<span>pattern1</span> <span>{</span> <span>action</span><span>;</span> <span>}</span> <span># just like lex</span>
<span>pattern2</span> <span>{</span> <span>action</span><span>;</span> <span>}</span>

<span># There is an implied loop and AWK automatically reads and parses each</span>
<span># record of each file supplied. Each record is split by the FS delimiter,</span>
<span># which defaults to white-space (multiple spaces,tabs count as one)</span>
<span># You can assign FS either on the command line (-F C) or in your BEGIN</span>
<span># pattern</span>

<span># One of the special patterns is BEGIN. The BEGIN pattern is true</span>
<span># BEFORE any of the files are read. The END pattern is true after</span>
<span># an End-of-file from the last file (or standard-in if no files specified)</span>
<span># There is also an output field separator (OFS) that you can assign, which</span>
<span># defaults to a single space</span>

<span>BEGIN</span> <span>{</span>

    <span># BEGIN will run at the beginning of the program. It's where you put all</span>
    <span># the preliminary set-up code, before you process any text files. If you</span>
    <span># have no text files, then think of BEGIN as the main entry point.</span>

    <span># Variables are global. Just set them or use them, no need to declare..</span>
    <span>count</span> <span>=</span> <span>0</span><span>;</span>

    <span># Operators just like in C and friends</span>
    <span>a</span> <span>=</span> <span>count</span> <span>+</span> <span>1</span><span>;</span>
    <span>b</span> <span>=</span> <span>count</span> <span>-</span> <span>1</span><span>;</span>
    <span>c</span> <span>=</span> <span>count</span> <span>*</span> <span>1</span><span>;</span>
    <span>d</span> <span>=</span> <span>count</span> <span>/</span> <span>1</span><span>;</span> <span># integer division</span>
    <span>e</span> <span>=</span> <span>count</span> <span>%</span> <span>1</span><span>;</span> <span># modulus</span>
    <span>f</span> <span>=</span> <span>count</span> <span>^</span> <span>1</span><span>;</span> <span># exponentiation</span>

    <span>a</span> <span>+=</span> <span>1</span><span>;</span>
    <span>b</span> <span>-=</span> <span>1</span><span>;</span>
    <span>c</span> <span>*=</span> <span>1</span><span>;</span>
    <span>d</span> <span>/=</span> <span>1</span><span>;</span>
    <span>e</span> <span>%=</span> <span>1</span><span>;</span>
    <span>f</span> <span>^=</span> <span>1</span><span>;</span>

    <span># Incrementing and decrementing by one</span>
    <span>a</span><span>++</span><span>;</span>
    <span>b</span><span>--</span><span>;</span>

    <span># As a prefix operator, it returns the incremented value</span>
    <span>++</span><span>a</span><span>;</span>
    <span>--</span><span>b</span><span>;</span>

    <span># Notice, also, no punctuation such as semicolons to terminate statements</span>

    <span># Control statements</span>
    <span>if</span> <span>(</span><span>count</span> <span>==</span> <span>0</span><span>)</span>
        <span>print</span> <span>"Starting with count of 0"</span><span>;</span>
    <span>else</span>
        <span>print</span> <span>"Huh?"</span><span>;</span>

    <span># Or you could use the ternary operator</span>
    <span>print</span> <span>(</span><span>count</span> <span>==</span> <span>0</span><span>)</span> <span>?</span> <span>"Starting with count of 0"</span> <span>:</span> <span>"Huh?"</span><span>;</span>

    <span># Blocks consisting of multiple lines use braces</span>
    <span>while</span> <span>(</span><span>a</span> <span>&lt;</span> <span>10</span><span>)</span> <span>{</span>
        <span>print</span> <span>"String concatenation is done"</span> <span>" with a series"</span> <span>" of"</span>
            <span>" space-separated strings"</span><span>;</span>
        <span>print</span> <span>a</span><span>;</span>

        <span>a</span><span>++</span><span>;</span>
    <span>}</span>

    <span>for</span> <span>(</span><span>i</span> <span>=</span> <span>0</span><span>;</span> <span>i</span> <span>&lt;</span> <span>10</span><span>;</span> <span>i</span><span>++</span><span>)</span>
        <span>print</span> <span>"Good ol' for loop"</span><span>;</span>

    <span># As for comparisons, they're the standards:</span>
    <span># a &lt; b   # Less than</span>
    <span># a &lt;= b  # Less than or equal</span>
    <span># a != b  # Not equal</span>
    <span># a == b  # Equal</span>
    <span># a &gt; b   # Greater than</span>
    <span># a &gt;= b  # Greater than or equal</span>

    <span># Logical operators as well</span>
    <span># a &amp;&amp; b  # AND</span>
    <span># a || b  # OR</span>

    <span># In addition, there's the super useful regular expression match</span>
    <span>if</span> <span>(</span><span>"foo"</span> <span>~</span> <span>"^fo+$"</span><span>)</span>
        <span>print</span> <span>"Fooey!"</span><span>;</span>
    <span>if</span> <span>(</span><span>"boo"</span> <span>!~</span> <span>"^fo+$"</span><span>)</span>
        <span>print</span> <span>"Boo!"</span><span>;</span>

    <span># Arrays</span>
    <span>arr</span><span>[</span><span>0</span><span>]</span> <span>=</span> <span>"foo"</span><span>;</span>
    <span>arr</span><span>[</span><span>1</span><span>]</span> <span>=</span> <span>"bar"</span><span>;</span>

    <span># You can also initialize an array with the built-in function split()</span>

    <span>n</span> <span>=</span> <span>split</span><span>(</span><span>"foo:bar:baz"</span><span>,</span> <span>arr</span><span>,</span> <span>":"</span><span>);</span>

    <span># You also have associative arrays (actually, they're all associative arrays)</span>
    <span>assoc</span><span>[</span><span>"foo"</span><span>]</span> <span>=</span> <span>"bar"</span><span>;</span>
    <span>assoc</span><span>[</span><span>"bar"</span><span>]</span> <span>=</span> <span>"baz"</span><span>;</span>

    <span># And multi-dimensional arrays, with some limitations I won't mention here</span>
    <span>multidim</span><span>[</span><span>0</span><span>,</span><span>0</span><span>]</span> <span>=</span> <span>"foo"</span><span>;</span>
    <span>multidim</span><span>[</span><span>0</span><span>,</span><span>1</span><span>]</span> <span>=</span> <span>"bar"</span><span>;</span>
    <span>multidim</span><span>[</span><span>1</span><span>,</span><span>0</span><span>]</span> <span>=</span> <span>"baz"</span><span>;</span>
    <span>multidim</span><span>[</span><span>1</span><span>,</span><span>1</span><span>]</span> <span>=</span> <span>"boo"</span><span>;</span>

    <span># You can test for array membership</span>
    <span>if</span> <span>(</span><span>"foo"</span> <span>in</span> <span>assoc</span><span>)</span>
        <span>print</span> <span>"Fooey!"</span><span>;</span>

    <span># You can also use the 'in' operator to traverse the keys of an array</span>
    <span>for</span> <span>(</span><span>key</span> <span>in</span> <span>assoc</span><span>)</span>
        <span>print</span> <span>assoc</span><span>[</span><span>key</span><span>];</span>

    <span># The command line is in a special array called ARGV</span>
    <span>for</span> <span>(</span><span>argnum</span> <span>in</span> <span>ARGV</span><span>)</span>
        <span>print</span> <span>ARGV</span><span>[</span><span>argnum</span><span>];</span>

    <span># You can remove elements of an array</span>
    <span># This is particularly useful to prevent AWK from assuming the arguments</span>
    <span># are files for it to process</span>
    <span>delete</span> <span>ARGV</span><span>[</span><span>1</span><span>];</span>

    <span># The number of command line arguments is in a variable called ARGC</span>
    <span>print</span> <span>ARGC</span><span>;</span>

    <span># AWK has several built-in functions. They fall into three categories. I'll</span>
    <span># demonstrate each of them in their own functions, defined later.</span>

    <span>return_value</span> <span>=</span> <span>arithmetic_functions</span><span>(</span><span>a</span><span>,</span> <span>b</span><span>,</span> <span>c</span><span>);</span>
    <span>string_functions</span><span>();</span>
    <span>io_functions</span><span>();</span>
<span>}</span>

<span># Here's how you define a function</span>
<span>function</span> <span>arithmetic_functions</span><span>(</span><span>a</span><span>,</span> <span>b</span><span>,</span> <span>c</span><span>,</span>     <span>d</span><span>)</span> <span>{</span>

    <span># Probably the most annoying part of AWK is that there are no local</span>
    <span># variables. Everything is global. For short scripts, this is fine, even</span>
    <span># useful, but for longer scripts, this can be a problem.</span>

    <span># There is a work-around (ahem, hack). Function arguments are local to the</span>
    <span># function, and AWK allows you to define more function arguments than it</span>
    <span># needs. So just stick local variable in the function declaration, like I</span>
    <span># did above. As a convention, stick in some extra whitespace to distinguish</span>
    <span># between actual function parameters and local variables. In this example,</span>
    <span># a, b, and c are actual parameters, while d is merely a local variable.</span>

    <span># Now, to demonstrate the arithmetic functions</span>

    <span># Most AWK implementations have some standard trig functions</span>
    <span>localvar</span> <span>=</span> <span>sin</span><span>(</span><span>a</span><span>);</span>
    <span>localvar</span> <span>=</span> <span>cos</span><span>(</span><span>a</span><span>);</span>
    <span>localvar</span> <span>=</span> <span>atan2</span><span>(</span><span>b</span><span>,</span> <span>a</span><span>);</span> <span># arc tangent of b / a</span>

    <span># And logarithmic stuff</span>
    <span>localvar</span> <span>=</span> <span>exp</span><span>(</span><span>a</span><span>);</span>
    <span>localvar</span> <span>=</span> <span>log</span><span>(</span><span>a</span><span>);</span>

    <span># Square root</span>
    <span>localvar</span> <span>=</span> <span>sqrt</span><span>(</span><span>a</span><span>);</span>

    <span># Truncate floating point to integer</span>
    <span>localvar</span> <span>=</span> <span>int</span><span>(</span><span>5.34</span><span>);</span> <span># localvar =&gt; 5</span>

    <span># Random numbers</span>
    <span>srand</span><span>();</span> <span># Supply a seed as an argument. By default, it uses the time of day</span>
    <span>localvar</span> <span>=</span> <span>rand</span><span>();</span> <span># Random number between 0 and 1.</span>

    <span># Here's how to return a value</span>
    <span>return</span> <span>localvar</span><span>;</span>
<span>}</span>

<span>function</span> <span>string_functions</span><span>(</span>    <span>localvar</span><span>,</span> <span>arr</span><span>)</span> <span>{</span>

    <span># AWK, being a string-processing language, has several string-related</span>
    <span># functions, many of which rely heavily on regular expressions.</span>

    <span># Search and replace, first instance (sub) or all instances (gsub)</span>
    <span># Both return number of matches replaced</span>
    <span>localvar</span> <span>=</span> <span>"fooooobar"</span><span>;</span>
    <span>sub</span><span>(</span><span>"fo+"</span><span>,</span> <span>"Meet me at the "</span><span>,</span> <span>localvar</span><span>);</span> <span># localvar =&gt; "Meet me at the bar"</span>
    <span>gsub</span><span>(</span><span>"e+"</span><span>,</span> <span>"."</span><span>,</span> <span>localvar</span><span>);</span> <span># localvar =&gt; "m..t m. at th. bar"</span>

    <span># Search for a string that matches a regular expression</span>
    <span># index() does the same thing, but doesn't allow a regular expression</span>
    <span>match</span><span>(</span><span>localvar</span><span>,</span> <span>"t"</span><span>);</span> <span># =&gt; 4, since the 't' is the fourth character</span>

    <span># Split on a delimiter</span>
    <span>n</span> <span>=</span> <span>split</span><span>(</span><span>"foo-bar-baz"</span><span>,</span> <span>arr</span><span>,</span> <span>"-"</span><span>);</span> <span># a[1] = "foo"; a[2] = "bar"; a[3] = "baz"; n = 3</span>

    <span># Other useful stuff</span>
    <span>sprintf</span><span>(</span><span>"%s %d %d %d"</span><span>,</span> <span>"Testing"</span><span>,</span> <span>1</span><span>,</span> <span>2</span><span>,</span> <span>3</span><span>);</span> <span># =&gt; "Testing 1 2 3"</span>
    <span>substr</span><span>(</span><span>"foobar"</span><span>,</span> <span>2</span><span>,</span> <span>3</span><span>);</span> <span># =&gt; "oob"</span>
    <span>substr</span><span>(</span><span>"foobar"</span><span>,</span> <span>4</span><span>);</span> <span># =&gt; "bar"</span>
    <span>length</span><span>(</span><span>"foo"</span><span>);</span> <span># =&gt; 3</span>
    <span>tolower</span><span>(</span><span>"FOO"</span><span>);</span> <span># =&gt; "foo"</span>
    <span>toupper</span><span>(</span><span>"foo"</span><span>);</span> <span># =&gt; "FOO"</span>
<span>}</span>

<span>function</span> <span>io_functions</span><span>(</span>    <span>localvar</span><span>)</span> <span>{</span>

    <span># You've already seen print</span>
    <span>print</span> <span>"Hello world"</span><span>;</span>

    <span># There's also printf</span>
    <span>printf</span><span>(</span><span>"%s %d %d %d\n"</span><span>,</span> <span>"Testing"</span><span>,</span> <span>1</span><span>,</span> <span>2</span><span>,</span> <span>3</span><span>);</span>

    <span># AWK doesn't have file handles, per se. It will automatically open a file</span>
    <span># handle for you when you use something that needs one. The string you used</span>
    <span># for this can be treated as a file handle, for purposes of I/O. This makes</span>
    <span># it feel sort of like shell scripting, but to get the same output, the string</span>
    <span># must match exactly, so use a variable:</span>

    <span>outfile</span> <span>=</span> <span>"/tmp/foobar.txt"</span><span>;</span>

    <span>print</span> <span>"foobar"</span> <span>&gt;</span> <span>outfile</span><span>;</span>

    <span># Now the string outfile is a file handle. You can close it:</span>
    <span>close</span><span>(</span><span>outfile</span><span>);</span>

    <span># Here's how you run something in the shell</span>
    <span>system</span><span>(</span><span>"echo foobar"</span><span>);</span> <span># =&gt; prints foobar</span>

    <span># Reads a line from standard input and stores in localvar</span>
    <span>getline</span> <span>localvar</span><span>;</span>

    <span># Reads a line from a pipe (again, use a string so you close it properly)</span>
    <span>cmd</span> <span>=</span> <span>"echo foobar"</span><span>;</span>
    <span>cmd</span> <span>|</span> <span>getline</span> <span>localvar</span><span>;</span> <span># localvar =&gt; "foobar"</span>
    <span>close</span><span>(</span><span>cmd</span><span>);</span>

    <span># Reads a line from a file and stores in localvar</span>
    <span>infile</span> <span>=</span> <span>"/tmp/foobar.txt"</span><span>;</span>
    <span>getline</span> <span>localvar</span> <span>&lt;</span> <span>infile</span><span>;</span> 
    <span>close</span><span>(</span><span>infile</span><span>);</span>
<span>}</span>

<span># As I said at the beginning, AWK programs consist of a collection of patterns</span>
<span># and actions. You've already seen the BEGIN pattern. Other</span>
<span># patterns are used only if you're processing lines from files or standard</span>
<span># input.</span>
<span>#</span>
<span># When you pass arguments to AWK, they are treated as file names to process.</span>
<span># It will process them all, in order. Think of it like an implicit for loop,</span>
<span># iterating over the lines in these files. these patterns and actions are like</span>
<span># switch statements inside the loop. </span>

<span>/^fo+bar$/</span> <span>{</span>

    <span># This action will execute for every line that matches the regular</span>
    <span># expression, /^fo+bar$/, and will be skipped for any line that fails to</span>
    <span># match it. Let's just print the line:</span>

    <span>print</span><span>;</span>

    <span># Whoa, no argument! That's because print has a default argument: $0.</span>
    <span># $0 is the name of the current line being processed. It is created</span>
    <span># automatically for you.</span>

    <span># You can probably guess there are other $ variables. Every line is</span>
    <span># implicitly split before every action is called, much like the shell</span>
    <span># does. And, like the shell, each field can be access with a dollar sign</span>

    <span># This will print the second and fourth fields in the line</span>
    <span>print</span> <span>$</span><span>2</span><span>,</span> <span>$</span><span>4</span><span>;</span>

    <span># AWK automatically defines many other variables to help you inspect and</span>
    <span># process each line. The most important one is NF</span>

    <span># Prints the number of fields on this line</span>
    <span>print</span> <span>NF</span><span>;</span>

    <span># Print the last field on this line</span>
    <span>print</span> <span>$</span><span>NF</span><span>;</span>
<span>}</span>

<span># Every pattern is actually a true/false test. The regular expression in the</span>
<span># last pattern is also a true/false test, but part of it was hidden. If you</span>
<span># don't give it a string to test, it will assume $0, the line that it's</span>
<span># currently processing. Thus, the complete version of it is this:</span>

<span>$</span><span>0</span> <span>~</span> <span>/^fo+bar$/</span> <span>{</span>
    <span>print</span> <span>"Equivalent to the last pattern"</span><span>;</span>
<span>}</span>

<span>a</span> <span>&gt;</span> <span>0</span> <span>{</span>
    <span># This will execute once for each line, as long as a is positive</span>
<span>}</span>

<span># You get the idea. Processing text files, reading in a line at a time, and</span>
<span># doing something with it, particularly splitting on a delimiter, is so common</span>
<span># in UNIX that AWK is a scripting language that does all of it for you, without</span>
<span># you needing to ask. All you have to do is write the patterns and actions</span>
<span># based on what you expect of the input, and what you want to do with it.</span>

<span># Here's a quick example of a simple script, the sort of thing AWK is perfect</span>
<span># for. It will read a name from standard input and then will print the average</span>
<span># age of everyone with that first name. Let's say you supply as an argument the</span>
<span># name of a this data file:</span>
<span>#</span>
<span># Bob Jones 32</span>
<span># Jane Doe 22</span>
<span># Steve Stevens 83</span>
<span># Bob Smith 29</span>
<span># Bob Barker 72</span>
<span>#</span>
<span># Here's the script:</span>

<span>BEGIN</span> <span>{</span>

    <span># First, ask the user for the name</span>
    <span>print</span> <span>"What name would you like the average age for?"</span><span>;</span>

    <span># Get a line from standard input, not from files on the command line</span>
    <span>getline</span> <span>name</span> <span>&lt;</span> <span>"/dev/stdin"</span><span>;</span>
<span>}</span>

<span># Now, match every line whose first field is the given name</span>
<span>$</span><span>1</span> <span>==</span> <span>name</span> <span>{</span>

    <span># Inside here, we have access to a number of useful variables, already</span>
    <span># pre-loaded for us:</span>
    <span># $0 is the entire line</span>
    <span># $3 is the third field, the age, which is what we're interested in here</span>
    <span># NF is the number of fields, which should be 3</span>
    <span># NR is the number of records (lines) seen so far</span>
    <span># FILENAME is the name of the file being processed</span>
    <span># FS is the field separator being used, which is " " here</span>
    <span># ...etc. There are plenty more, documented in the man page.</span>

    <span># Keep track of a running total and how many lines matched</span>
    <span>sum</span> <span>+=</span> <span>$</span><span>3</span><span>;</span>
    <span>nlines</span><span>++</span><span>;</span>
<span>}</span>

<span># Another special pattern is called END. It will run after processing all the</span>
<span># text files. Unlike BEGIN, it will only run if you've given it input to</span>
<span># process. It will run after all the files have been read and processed</span>
<span># according to the rules and actions you've provided. The purpose of it is</span>
<span># usually to output some kind of final report, or do something with the</span>
<span># aggregate of the data you've accumulated over the course of the script.</span>

<span>END</span> <span>{</span>
    <span>if</span> <span>(</span><span>nlines</span><span>)</span>
        <span>print</span> <span>"The average age for "</span> <span>name</span> <span>" is "</span> <span>sum</span> <span>/</span> <span>nlines</span><span>;</span>
<span>}</span>
</pre><p><span>&nbsp;</span></p></div>]]></description>
	<dc:creator>BioJoker</dc:creator>
</item>

</channel>
</rss>