<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Interesting Shell Script Requirement in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977978#M99484</link>
    <description>create a file called "pull.awk" which looks like this:&lt;BR /&gt;&lt;BR /&gt;NR&amp;lt;7&amp;amp;&amp;amp;NR&amp;gt;3 {for (idx=1;idx=NF;idx++) {printf("%s,",$idx);}&lt;BR /&gt;            printf("\n");}&lt;BR /&gt;&lt;BR /&gt;awk -f pull.awk &amp;lt; inputfile &amp;gt; outputfile&lt;BR /&gt;&lt;BR /&gt;That takes care of the comma seperated part.&lt;BR /&gt;&lt;BR /&gt;What is the file name syntax that you are using for each file?&lt;BR /&gt;</description>
    <pubDate>Tue, 09 May 2006 09:05:01 GMT</pubDate>
    <dc:creator>Kent Ostby</dc:creator>
    <dc:date>2006-05-09T09:05:01Z</dc:date>
    <item>
      <title>Interesting Shell Script Requirement</title>
      <link>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977975#M99481</link>
      <description>There is a command for which the output is as follows&lt;BR /&gt;&lt;BR /&gt;-----------------------------------&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;4 5 6 7&lt;BR /&gt;8 9 10 11&lt;BR /&gt;12 13 14 15&lt;BR /&gt;16 17 18 19&lt;BR /&gt;&lt;BR /&gt;-----------------------------------&lt;BR /&gt;&lt;BR /&gt;The requirement is to extract information from the 4th line and write it to a file as comma separated values 4, 5, 6, 7&lt;BR /&gt;&lt;BR /&gt;And similary for the next two lines(each line goes to a different file.)&lt;BR /&gt;&lt;BR /&gt;Is there a good way to do this?&lt;BR /&gt;&lt;BR /&gt;Any help in this regard would be highly appreciated.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Anurag</description>
      <pubDate>Tue, 09 May 2006 08:47:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977975#M99481</guid>
      <dc:creator>Anurag_7</dc:creator>
      <dc:date>2006-05-09T08:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting Shell Script Requirement</title>
      <link>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977976#M99482</link>
      <description>Maybe something like this:&lt;BR /&gt;&lt;BR /&gt;awk 'NR==$2 {print $0}' $1 | tr " " "," &amp;gt; $3&lt;BR /&gt;&lt;BR /&gt;Usage:&lt;BR /&gt;&lt;BR /&gt;script.sh line_numb input_file output_file</description>
      <pubDate>Tue, 09 May 2006 08:59:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977976#M99482</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2006-05-09T08:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting Shell Script Requirement</title>
      <link>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977977#M99483</link>
      <description>Anurag,&lt;BR /&gt;assuming your initial data file is called a.dat. Also that there are no trailing spaces.&lt;BR /&gt;This command translates all spaces into commas and writes the new data to file b.dat.&lt;BR /&gt;&lt;BR /&gt;tr " " "," &amp;lt; a.dat &amp;gt; b.dat&lt;BR /&gt;&lt;BR /&gt;will create&lt;BR /&gt;&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;4,5,6,7&lt;BR /&gt;8,9,10,11&lt;BR /&gt;12,13,14,15&lt;BR /&gt;16,17,18,19</description>
      <pubDate>Tue, 09 May 2006 09:00:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977977#M99483</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-05-09T09:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting Shell Script Requirement</title>
      <link>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977978#M99484</link>
      <description>create a file called "pull.awk" which looks like this:&lt;BR /&gt;&lt;BR /&gt;NR&amp;lt;7&amp;amp;&amp;amp;NR&amp;gt;3 {for (idx=1;idx=NF;idx++) {printf("%s,",$idx);}&lt;BR /&gt;            printf("\n");}&lt;BR /&gt;&lt;BR /&gt;awk -f pull.awk &amp;lt; inputfile &amp;gt; outputfile&lt;BR /&gt;&lt;BR /&gt;That takes care of the comma seperated part.&lt;BR /&gt;&lt;BR /&gt;What is the file name syntax that you are using for each file?&lt;BR /&gt;</description>
      <pubDate>Tue, 09 May 2006 09:05:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977978#M99484</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2006-05-09T09:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting Shell Script Requirement</title>
      <link>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977979#M99485</link>
      <description>Hi,&lt;BR /&gt;you can try with:&lt;BR /&gt;&lt;BR /&gt;head -n n_of_line file_source|tail -1|sed 's/ /,/g' &amp;gt; file_dest&lt;BR /&gt;&lt;BR /&gt;Enrico</description>
      <pubDate>Tue, 09 May 2006 09:29:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977979#M99485</guid>
      <dc:creator>Enrico P.</dc:creator>
      <dc:date>2006-05-09T09:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting Shell Script Requirement</title>
      <link>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977980#M99486</link>
      <description>Here is something that will generate the individual files. 1 per line starting with the fourth line of your input file-&lt;BR /&gt; &lt;BR /&gt;awk 'NR&amp;gt;3{gsub(" ",",");print $0}' yourdata.dat | split -l1 - outfil&lt;BR /&gt; &lt;BR /&gt;This will generate files outfilaa, outfileab, etc. One file per line.&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Tue, 09 May 2006 09:46:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977980#M99486</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2006-05-09T09:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting Shell Script Requirement</title>
      <link>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977981#M99487</link>
      <description>I'm looking for the interesting requirement; none of this interests me in the least.</description>
      <pubDate>Tue, 09 May 2006 09:51:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977981#M99487</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-05-09T09:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting Shell Script Requirement</title>
      <link>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977982#M99488</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;yourcommand |&lt;BR /&gt;awk -v OFS=, 'NR&amp;gt;3 {out="/tmp/outf"++x;for (i=1;i&lt;NF&gt;out;print $NF &amp;gt;out;close(out)}'&lt;BR /&gt;&lt;BR /&gt;will produce files /tmp/outf* .&lt;BR /&gt;&lt;BR /&gt;mfG Peter&lt;/NF&gt;</description>
      <pubDate>Tue, 09 May 2006 12:12:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977982#M99488</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-05-09T12:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting Shell Script Requirement</title>
      <link>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977983#M99489</link>
      <description>Thanks a lot Iva, Peter Godron, Kent, Enrico, Rodney, Peter Niktka......&lt;BR /&gt;&lt;BR /&gt;All the solution were damn good......&lt;BR /&gt;&lt;BR /&gt;I will handle the naming convention for the output files myself.&lt;BR /&gt;&lt;BR /&gt;Thanks a lot again&lt;BR /&gt;&lt;BR /&gt;Anurag</description>
      <pubDate>Tue, 09 May 2006 12:20:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977983#M99489</guid>
      <dc:creator>Anurag_7</dc:creator>
      <dc:date>2006-05-09T12:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting Shell Script Requirement</title>
      <link>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977984#M99490</link>
      <description>Solution Found with the help of other forum members.</description>
      <pubDate>Tue, 09 May 2006 12:23:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/interesting-shell-script-requirement/m-p/4977984#M99490</guid>
      <dc:creator>Anurag_7</dc:creator>
      <dc:date>2006-05-09T12:23:24Z</dc:date>
    </item>
  </channel>
</rss>

