The UNIX and Linux Forums  


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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Enable a shell to collect data from unix, return to windows rossalyn_maxter UNIX for Dummies Questions & Answers 1 12-19-2007 01:55 AM
ccall database and collect data from one table rinku Shell Programming and Scripting 0 05-28-2007 02:16 AM
Using loop reading a file,retrieving data from data base. Sonu4lov Shell Programming and Scripting 1 01-19-2007 03:38 AM
Best way to collect bounces kevin9 UNIX for Dummies Questions & Answers 2 10-05-2005 04:13 PM
collect-process arn_ch UNIX for Dummies Questions & Answers 1 03-29-2001 01:02 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:56 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0