title: Extract data from one text file
body: <p>sorry for creating confusion, i need a script and my requirement is if i am 
  having text file which contains header,records &amp; tail for 
  eg:- Test1.txt (input File)<br>
  for example<br>
  i have a text file  </p>
  
  <h2>Input file</h2>
  
  <pre><code>test1.txt   
  ---------   
  2013101000490398938---HEADER
  rohitroshankavuriM26single2010198702092013000(4053 characters each line contains)
  rohitroshankavuriM26single2010198702092013000(4053 characters each line contains)
  rohitroshankavuriM26single2010198702092013000(4053 characters each line contains)
  rohitroshankavuriM26single2010198702092013000(4053 characters each line contains)
  rohitroshankavuriM26single2010198702092013000(4053 characters each line contains)
  201310100004005--TAIL
  </code></pre>
  
  <p>i need to write a UNIX shell script which will extract specific columns data from
  input file based on their positions because i don't have delimiters or not even
  spaces.And here i have to extract some columns(randomly i can pick based on their
  positions) and save them to text file </p>
  
  <p>for suppose eg: if i need a text file that should extract data from position
  1-5,6-8,9,10-12  as shown and it should not contain header and tail.  </p>
  
  <pre><code>normally i have used this script to
  
  #Create as same as the input file    
  cat Test1.txt&gt;tmp.txt    
  #here i will delete the header and tail from the tmp.txt file    
  sed '1d,$d' tmp.txt    
  #now i will extract the data based upon the    
  cut 1-5,6-8,9,10-12 Test1.txt&gt;Test2.txt  
  </code></pre>
  
  <p>O/P will be like this<br>
      Test2.txt<br>
      ---------<br>
      rohitroshank<br>
      rohitroshank<br>
      rohitroshank<br>
      rohitroshank   </p>
  
  <p>Now my 1st output file is ready Test2.txt </p>
  
  <h2>My Second requirement</h2>
  
  <p>now same output as 1st output file but here i can pick some different columns but it<br>
  should contains the data with header, records, tail<br>
  for eg:</p>
  
  <p>To print first line which is header and after that i am having records and after
  tail     </p>
  
  <pre><code>Test3.txt(output file)      
  --------------------------    
   #to print the head    
   head -1 tmp.txt&gt;Test3.txt     
   #now i will pick specific columns based upon my positions &amp; append it to test3.txt
   cut 13-15,16-19,20 tmp.txt&gt;&gt;Test3.txt    
   #print and append it to Test3.txt file     
   tail -1 tmp.txt&gt;&gt;Test.txt 
  </code></pre>
  
  <h2>Output Test3.txt</h2>
  
  <p>2013101000490398938<br>
  avuriM26<br>
  avuriM26<br>
  avuriM26<br>
  avuriM26<br>
  avuriM26<br>
  avuriM26<br>
  avuriM26<br>
  201310100004005 </p>
  
  <p>Till now my requirement is completed But is there any other simple way to get this
      output.If yes please share me script so it will useful for me.      </p>
  
  <pre><code>And but also now i am stuck with a problem i.e     
  extracting specific columns data using CUT command.see any text file      
  each line will contain 1024 characters but i have 4093 characters so how would i 
  approach this requirement rather than doing it using CUT.
  
  Is there any other way please suggest me. If are having any queries regarding my
  requirement comment it here
  </code></pre>