{"id":5099,"date":"2021-11-12T10:56:13","date_gmt":"2021-11-12T10:56:13","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=5099"},"modified":"2021-11-12T10:58:01","modified_gmt":"2021-11-12T10:58:01","slug":"read-a-file-and-creating-variables-in-csh","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/unix\/read-a-file-and-creating-variables-in-csh\/8582.html","title":{"rendered":"Read A File And Creating Variables In Csh"},"content":{"rendered":"<p>hi,<\/p>\n<p>I need to merge a few files together the problem is that I have so many files that it will takes me week to get all the job done&#8230;<\/p>\n<p>In fact, I wrote a script that put in a text file the name of the files that need to be merged.<\/p>\n<p>foreach stn (`cat ..\/stnlist`)<br \/>\nls *$stn.* &gt; tmp$stn<\/p>\n<p>Now I need to add to this script a part where it read each line of tmp$stn and give each filenames (lines) a variable (first one = 1, second one = 2,&#8230;). I can&#8217;t know in advance how many line I have but shouldn&#8217;t be more then 10 each time.<\/p>\n<p>The variables will then be put into the following script so I would also need to be able to count the numbers of lines and also put that into a variables to ask the script to merge x number of files.<\/p>\n<p>\/usr\/local\/sac\/bin\/sac &lt;&lt; endsac<br \/>\nr $1<br \/>\nm $2<br \/>\nm $3<br \/>\n&#8230;<br \/>\nw x$1<br \/>\nquit<br \/>\nendsac<\/p>\n<p>Hope someone could help me&#8230; I&#8217;m on my master thesis and I don&#8217;t have weeks to do that&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":5},"question-category":[64],"question_tags":[],"class_list":["post-5099","question","type-question","status-publish","hentry","question-category-unix"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/5099","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=5099"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=5099"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=5099"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=5099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}