Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-02-2004, 04:27 AM   #1
Registered: May 2004
Posts: 80

Rep: Reputation: 15
perl printing

how to match a field in a line and print the next line??
Old 06-02-2004, 03:07 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 65
What about something like:
# Loop through the lines
foreach $line (@lines){
 # If the last line matched then print it
 if($next eq "print"){
  print $line;
 # If the line contains "somestring" then keep track in a variable

Last edited by david_ross; 06-02-2004 at 03:09 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl - printing progress on same line. Technoslave Programming 7 09-03-2011 10:20 PM
printing Spanish accent characters in Perl/tk entry widget puedo Programming 1 02-19-2005 02:16 PM
Perl - printing features satimis Programming 6 11-14-2004 12:45 PM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 09:09 PM
chrooting apache v2 (php, ssl, perl support) ; perl configuration markus1982 Linux - Security 3 01-26-2003 07:15 PM

All times are GMT -5. The time now is 02:48 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration