The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
while loop inside while loop panknil Shell Programming and Scripting 0 01-07-2008 09:49 AM
For loop xramm HP-UX 3 10-10-2007 11:20 AM
While Loop hemangjani Shell Programming and Scripting 2 11-02-2006 08:01 AM
for loop munnabhai1 Shell Programming and Scripting 3 04-06-2006 11:30 AM
how to get the similar function in while loop or for loop trynew Shell Programming and Scripting 3 06-17-2002 08:09 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-10-2006
Registered User
 

Join Date: Sep 2006
Posts: 18
Question for loop or other ?

Hi, i'm writting a krnshell script (sun solaris) that reads data that is entered to it and does an echo or something else, one section at a time. The data being entered would be something like this:
1111 <---- this being the begining of the section of info till it gets to the next
saxxxxx
saxxxxx
saxxxxx <--- this is the end of the section, this will vary like for instance 2's
2222 have only 2 items under it.
saxxxx
saxxxx
quit

#!/bin/ksh
echo " Line id: "
read lid
while [ $lid != "quit" ]
do
echo "$lid" >> file
read lid
done
for x in `grep yyyy file` yyyy <-- are the 4 digit numbers above one at a time
do
echo "$x"
for sn in `grep sa file`
do
echo "$sn"
done
done
rm file
rm file_b
exit

I think i tried it like this and i get 1111 then all the saxxx's below it. Not the way i need it, 1111 then saxx's below 1111 then 2222 then saxx's below it from the file. I hope this understandable. Any help appreciated. Thanks
Reply With Quote
Forum Sponsor
  #2  
Old 11-11-2006
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
Quote:
Originally Posted by wisher115
I hope this understandable.


As near as I can determine the output would be identical to the input and thus you do not need a script.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:10 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0