The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-21-2007
bikas_jena bikas_jena is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 13
collect data from another file

Hi Friends ,
I am urgently needed your help.
could you pleas help me in creating the shell script.

Requirement :
collect the data from no_file.txt

no_file.txt
============
1
11
265
290
300
313
326
351

Then create another shele script like
my_shell.csh
===========
head -11 M2_Sales_N01.txt |tail -10 >M2_Sales_N01_01.txt
head -265 M2_Sales_N01.txt |tail -254>M2_Sales_N01_02.txt
head -290 M2_Sales_N01.txt |tail -25 >M2_Sales_N01_03.txt
head -300 M2_Sales_N01.txt |tail -10 >M2_Sales_N01_04.txt

head -313 M2_Sales_N01.txt |tail -13 >M2_Sales_N01_05.txt
head -326 M2_Sales_N01.txt |tail -13 >M2_Sales_N01_06.txt
head -351 M2_Sales_N01.txt |tail -25 >M2_Sales_N01_07.txt
....
....

Logic
=====
fetch the first two digit (1,11) then last-first, 11-1 =10
head -11 M2_Sales_N01.txt |tail -10 >M2_Sales_N01_01.txt

fetch next two nos (265,11) .Then 265-11=254
head -265 M2_Sales_N01.txt |tail -254>M2_Sales_N01_02.txt

Thanks In advance.
Bikas