{"id":269,"date":"2020-05-13T21:05:56","date_gmt":"2020-05-13T21:05:56","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=269"},"modified":"2020-12-13T21:08:54","modified_gmt":"2020-12-13T21:08:54","slug":"bash-sorting-and-merging-files","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/bash-sorting-and-merging-files\/","title":{"rendered":"bash: Sorting and Merging files"},"content":{"rendered":"\n<p>The following script merges several files into one file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\necho \"Please specify a directory\"\nread folder\ncd $folder\nls | sort -n\nfor i in *.fasta\n    do\n    cat $i >> virus\ndone<\/code><\/pre>\n\n\n\n<p>Line 5 creates a sorted list of directory contents. Line six loops through all files with .fasta extension. Line 8 appends contents of every file to the file virus.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following script merges several files into one file. Line 5 creates a sorted list of directory contents. Line six loops through all files with .fasta extension. Line 8 appends contents of every file to the file virus.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101,34],"tags":[94,35],"class_list":["post-269","post","type-post","status-publish","format-standard","hentry","category-bash","category-linux","tag-bash","tag-linux"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/269","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=269"}],"version-history":[{"count":2,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/269\/revisions"}],"predecessor-version":[{"id":271,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/269\/revisions\/271"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}