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
Reading specific contents from 1 input files and appending it to another input file sksahu Shell Programming and Scripting 5 01-14-2009 06:09 AM
reading input from a file nadbar Shell Programming and Scripting 2 01-07-2009 08:12 PM
Help reading an input file in KSH zilla30066 Shell Programming and Scripting 2 02-01-2007 06:45 AM
Script for reading an input file gzs553 Shell Programming and Scripting 1 10-17-2006 07:55 AM
Reading Input from File and Duplicates Output noelcantona Shell Programming and Scripting 6 10-18-2005 05:59 AM

 
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 4 Weeks Ago
subhap subhap is offline
Registered User
  
 

Join Date: Oct 2009
Location: Southern California
Posts: 6
perl how to exit a while loop and quit reading the input file

I am reading a file using While loop


Code:
while <FILE>
{
  $_ = <FILE>; 
  process data... 

}

I would like to quit reading the file once I encounter a String pattern. How do i do it.

is it

Code:
 if (/SUMMARY/)
 { 
  last; 
 }

I am having problems with uninitialized value in pattern matching and substitution and the while Loop does not end. Don't know how to get around that either..

thanks

Last edited by pludi; 4 Weeks Ago at 05:29 PM..
 

Bookmarks

Tags
while loop error recursion

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 06:25 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