{"id":11069,"date":"2020-05-27T16:01:41","date_gmt":"2020-05-27T14:01:41","guid":{"rendered":"https:\/\/wp.jochen.hayek.name\/blog-en\/?p=11069"},"modified":"2020-08-05T13:11:01","modified_gmt":"2020-08-05T11:11:01","slug":"from-last-line-to-first-line","status":"publish","type":"post","link":"https:\/\/wp.jochen.hayek.name\/blog-en\/2020\/05\/27\/from-last-line-to-first-line\/","title":{"rendered":"how can I read a file from last line to first line on the Unix command line?"},"content":{"rendered":"\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/stackoverflow.com\/questions\/48721344\/how-can-i-read-a-file-from-last-line-to-first-line-in-shell\">https:\/\/stackoverflow.com\/questions\/48721344\/how-can-i-read-a-file-from-last-line-to-first-line-in-shell<\/a><\/li><li><a href=\"https:\/\/www.man7.org\/linux\/man-pages\/man1\/tac.1.html\">https:\/\/www.man7.org\/linux\/man-pages\/man1\/tac.1.html<\/a> \u2013 <em>cat<\/em> vs <em>tac<\/em><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">$ perl -e 'print reverse &lt;&gt;' Input_file<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">There are also solutions in awk and sed \u2013 read the stackoverflow article for those solutions!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/stackoverflow.com\/questions\/48721344\/how-can-i-read-a-file-from-last-line-to-first-line-in-shell https:\/\/www.man7.org\/linux\/man-pages\/man1\/tac.1.html \u2013 cat vs tac $ perl -e &#8216;print reverse &lt;&gt;&#8217; Input_file There are also solutions in awk and sed \u2013 read the stackoverflow article for those solutions!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_share_on_mastodon":"0"},"categories":[530,596,623,673],"tags":[],"class_list":["post-11069","post","type-post","status-publish","format-standard","hentry","category-shell-command-line","category-the-awk-programming-language","category-the-perl-programming-language","category-unix_utilities"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paO0kP-2Sx","jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/11069","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/comments?post=11069"}],"version-history":[{"count":3,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/11069\/revisions"}],"predecessor-version":[{"id":11134,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/11069\/revisions\/11134"}],"wp:attachment":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/media?parent=11069"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/categories?post=11069"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/tags?post=11069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}