{"id":26598,"date":"2018-05-07T04:05:28","date_gmt":"2018-05-07T09:05:28","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=26598"},"modified":"2022-12-07T10:19:27","modified_gmt":"2022-12-07T16:19:27","slug":"awk-command-examples","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/","title":{"rendered":"AWK Command Examples in Linux"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div><p><img decoding=\"async\" class=\"alignnone wp-image-28454 size-full\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/05\/awk-command-examples-in-linux.jpg\" alt=\"awk command examples in linux\" width=\"742\" height=\"371\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/05\/awk-command-examples-in-linux.jpg 742w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/05\/awk-command-examples-in-linux-150x75.jpg 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/05\/awk-command-examples-in-linux-300x150.jpg 300w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/p>\n<p>AWK is a very useful scripting language for text processing. This language is executed by the awk interpreter. It allows the user to process some input, define variables, use logical operators, string and numeric functions, extract data and generate formatted reports. AWK&#8217;s syntax is very familiar to C language and it is a direct predecessor of Perl. All AWK scripts can be converted into Perl scripts using a2p utility.\u00a0In this tutorial, we will show you several practical examples of\u00a0<strong>awk command examples in Linux<\/strong>.<\/p>\n<p><!--more--><\/p>\n<h3>Prerequisites<\/h3>\n<p>The AWK interpreter is a standard tool found on every Linux distribution. The gawk package contains the open source version of AWK, and depending on the Linux distribution, it can be installed from a source file or using the gawk or mawk packages included with the specific Linux distribution.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69d26a0d3cfae\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69d26a0d3cfae\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/#How-to-install-AWK-in-Linux\" >How to install AWK in Linux<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/#AWK-Command-Examples-in-Linux\" >AWK Command Examples in Linux<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"How-to-install-AWK-in-Linux\"><\/span>How to install AWK in Linux<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><a href=\"https:\/\/www.rosehosting.com\/blog\/connect-to-your-linux-vps-via-ssh\/\">Login to your\u00a0 server via SSH<\/a> as user root<\/p>\n<pre>ssh root@IP_Address<\/pre>\n<p>In order to install the AWK command line utility on CentOS\/Fedora or any other RPM-based Linux distribution, run the following command:<\/p>\n<pre>yum install gawk<\/pre>\n<p>On Ubuntu\/Debian, you need to invoke this command to install gawk:<\/p>\n<pre>apt-get install gawk<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"AWK-Command-Examples-in-Linux\"><\/span>AWK Command Examples in Linux<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Simple awk commands can be easily run from the command line, and for more complex tasks should be written as awk scripts to a file. Listed below are some useful examples of awk commands and executable scripts.<\/p>\n<ul>\n<li>You can use the AWK command to print only certain columns from the input field. For example, using the command given below you can find out the list IP addresses which are connected to your server:<\/li>\n<\/ul>\n<pre>netstat -anp|grep tcp|awk '{print $5}'| cut -d : -f1 | sort | uniq -c | sort -n<\/pre>\n<p>This is quite useful if you are investigating if your server is under a DoS or DDoS attack.<\/p>\n<ul>\n<li>In the following example, we use AWK to search for a particular pattern in certain columns and do some action based on the result:<\/li>\n<\/ul>\n<pre>exim -bpr | grep frozen | awk {'print $3'} | xargs exim -Mrm<\/pre>\n<p>The command above will delete all frozen emails from the Exim mail queue.<\/p>\n<ul>\n<li>AWK is often used to perform useful and practical text processing and manipulation. For example, we can use awk to remove duplicates in a text file without sorting:<\/li>\n<\/ul>\n<pre>awk '!x[$0]++' file-with-duplicates &gt; new-file-without-duplicates<\/pre>\n<ul>\n<li>The following command will print five random numbers from 0 to 999:<\/li>\n<\/ul>\n<pre>awk 'BEGIN { for (i = 1; i &lt;= 5; i++) print int(1000 * rand()) }'<\/pre>\n<ul>\n<li>Use the following command to count the number of lines in a file named &#8216;sample_file&#8217;:<\/li>\n<\/ul>\n<pre>awk 'END { print NR }' sample_file<\/pre>\n<ul>\n<li>The following command will print all lines in a file named sample-file which contain strings starting with either &#8216;A&#8217; or &#8216;a&#8217;, followed by &#8216;re&#8217;:<\/li>\n<\/ul>\n<pre>awk '\/[Aa]re\/{print}' \/opt\/sample_file<\/pre>\n<ul>\n<li>You can use the AWK command for more complex operations. If your website looks somewhat slow, you may use the following command to check if there is some problem with the disk I\/O (and\/or network in some rare cases):<\/li>\n<\/ul>\n<pre>tac \/proc\/stat | awk '\/^btime\/ {up=systime()-$2;print \"up \" up\/86400 \"d\"}; \/^cpu \/ {print \"user \" $2\/up \"%, nice \" $3\/up \"%, sys \" $4\/up \"%, idle \" $5\/up \"%, iowait \" $6\/up \"%, steal \" $9\/up \"%\\niowait\/used \" $6 \/ ($2+$3+$4) \", steal\/used \" $9 \/ ($2+$3+$4) }'<\/pre>\n<p>IOWAIT means how long processes are blocked by busy I\/O, mostly disk storage or perhaps network. STEAL means how long processes are blocked by luck of CPU timeslice on the server. Higher iowait perused CPU time (=USER + NICE + SYSTEM) shows busy I\/O, higher STEAL perused shows busy CPU.<\/p>\n<ul>\n<li>The following script uses a simple awk command that searches the input file &#8216;\/etc\/passwd&#8217; and provides an output with the username followed by the date and time of the last login:<\/li>\n<\/ul>\n<pre>vi login-check<\/pre>\n<pre>#!\/bin\/bash\r\n\r\nfor user in `awk -F: '{print $1}' \/etc\/passwd`\r\ndo\r\necho -n \"$user: \"\r\nfinger $user | grep Last\r\nif [ $? != 0 ]; then\r\necho\r\nfi\r\ndone<\/pre>\n<p>Make the script executable:<\/p>\n<pre>chmod 755 login-check<\/pre>\n<p>Run the script:<\/p>\n<pre>.\/login-check<\/pre>\n<p>You should be able to see the user accounts available on your server, followed by the date and time of the last login of each user.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>There are some newer languages such as Perl and Python which can be used instead of AWK, but using <strong>AWK commands in Linux<\/strong>, has some advantages because:<\/p>\n<ul>\n<li>AWK is very easy to learn.<\/li>\n<li>AWK can be used to solve certain types of problems faster and write more efficient scripts than using other tools\/languages.<\/li>\n<li>AWK comes very handily when working with large files like logs etc. because using AWK command\/scripts you can produce a filtered and readable report.<\/li>\n<\/ul>\n<hr \/>\n<p><img decoding=\"async\" class=\"alignleft size-full wp-image-26723\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/05\/awk-command-example.jpg\" alt=\"awk command example\" width=\"207\" height=\"244\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/05\/awk-command-example.jpg 207w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/05\/awk-command-example-127x150.jpg 127w\" sizes=\"(max-width: 207px) 100vw, 207px\" \/>Of course, you don\u2019t have to do any of this, if you use one of our <a href=\"https:\/\/www.rosehosting.com\/managed-vps-hosting.html\" target=\"_blank\" rel=\"noopener noreferrer\">Optimized VPS Hosting Solutions<\/a>, in which case you can simply ask our expert Linux admins to help you with this. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n<p><span style=\"color: #ff0000;\"><strong>PS<\/strong><\/span>. If you liked this post on AWK command examples in Linux, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AWK is a very useful scripting language for text processing. This language is executed by the awk interpreter. It allows &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"AWK Command Examples in Linux\" class=\"read-more button\" href=\"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/#more-26598\" aria-label=\"Read more about AWK Command Examples in Linux\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":28454,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[1684,1685],"class_list":["post-26598","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-awk","tag-awk-examples","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>AWK Command Examples in Linux | RoseHosting<\/title>\n<meta name=\"description\" content=\"AWK Command Examples in Linux | RoseHosting\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AWK Command Examples in Linux\" \/>\n<meta property=\"og:description\" content=\"AWK Command Examples in Linux | RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2018-05-07T09:05:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-07T16:19:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/05\/awk-command-examples-in-linux.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"742\" \/>\n\t<meta property=\"og:image:height\" content=\"371\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/awk-command-examples\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/awk-command-examples\\\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"AWK Command Examples in Linux\",\"datePublished\":\"2018-05-07T09:05:28+00:00\",\"dateModified\":\"2022-12-07T16:19:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/awk-command-examples\\\/\"},\"wordCount\":721,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/awk-command-examples\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/05\\\/awk-command-examples-in-linux.jpg\",\"keywords\":[\"AWK\",\"awk examples\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/awk-command-examples\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/awk-command-examples\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/awk-command-examples\\\/\",\"name\":\"AWK Command Examples in Linux | RoseHosting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/awk-command-examples\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/awk-command-examples\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/05\\\/awk-command-examples-in-linux.jpg\",\"datePublished\":\"2018-05-07T09:05:28+00:00\",\"dateModified\":\"2022-12-07T16:19:27+00:00\",\"description\":\"AWK Command Examples in Linux | RoseHosting\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/awk-command-examples\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/awk-command-examples\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/awk-command-examples\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/05\\\/awk-command-examples-in-linux.jpg\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/05\\\/awk-command-examples-in-linux.jpg\",\"width\":742,\"height\":371,\"caption\":\"awk command examples in linux\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/awk-command-examples\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AWK Command Examples in Linux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"name\":\"RoseHosting.com\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/RoseHosting\",\"https:\\\/\\\/x.com\\\/rosehosting\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/rosehosting\\\/\"],\"description\":\"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.\",\"email\":\"info@rosehosting.com\",\"telephone\":\"(314) 275-0414\",\"legalName\":\"Rose Web Services LLC\",\"foundingDate\":\"2001-04-02\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"11\",\"maxValue\":\"50\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\\\/\\\/www.rosehosting.com\",\"https:\\\/\\\/www.facebook.com\\\/rosehosting.helpdesk\"],\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/author\\\/jwilson\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"AWK Command Examples in Linux | RoseHosting","description":"AWK Command Examples in Linux | RoseHosting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/","og_locale":"en_US","og_type":"article","og_title":"AWK Command Examples in Linux","og_description":"AWK Command Examples in Linux | RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2018-05-07T09:05:28+00:00","article_modified_time":"2022-12-07T16:19:27+00:00","og_image":[{"width":742,"height":371,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/05\/awk-command-examples-in-linux.jpg","type":"image\/jpeg"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"AWK Command Examples in Linux","datePublished":"2018-05-07T09:05:28+00:00","dateModified":"2022-12-07T16:19:27+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/"},"wordCount":721,"commentCount":0,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/05\/awk-command-examples-in-linux.jpg","keywords":["AWK","awk examples"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/","url":"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/","name":"AWK Command Examples in Linux | RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/05\/awk-command-examples-in-linux.jpg","datePublished":"2018-05-07T09:05:28+00:00","dateModified":"2022-12-07T16:19:27+00:00","description":"AWK Command Examples in Linux | RoseHosting","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/05\/awk-command-examples-in-linux.jpg","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/05\/awk-command-examples-in-linux.jpg","width":742,"height":371,"caption":"awk command examples in linux"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/awk-command-examples\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"AWK Command Examples in Linux"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting.com","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"],"description":"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.","email":"info@rosehosting.com","telephone":"(314) 275-0414","legalName":"Rose Web Services LLC","foundingDate":"2001-04-02","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"11","maxValue":"50"}},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/26598","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=26598"}],"version-history":[{"count":3,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/26598\/revisions"}],"predecessor-version":[{"id":43770,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/26598\/revisions\/43770"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/28454"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=26598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=26598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=26598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}