The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
To find the time difference between two lines of the same log file satyakam Shell Programming and Scripting 2 04-30-2008 10:46 AM
How to find number of lines in a file somesh_p Shell Programming and Scripting 2 12-19-2007 09:15 PM
find string in .jar file rakeshou UNIX for Dummies Questions & Answers 8 07-06-2007 03:42 PM
Find lines greater than 80 characters in a file mrgubbala Shell Programming and Scripting 8 03-11-2007 12:51 AM
find and copy string in a file vascobrito UNIX for Advanced & Expert Users 10 03-03-2004 02:14 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-05-2007
lyoncc lyoncc is offline
Registered User
  
 

Join Date: May 2007
Posts: 21
find string, then get the next 3 lines in a file

Hi all. HPUX - /bin/sh (posix)

I am parsing a 3 field flat file, space deliminted

example data.file

acct dining mem
open 0 50
dep 50 0
close 255 0
acct plus mem
open 100 100
dep 50 0
close 323 0

I would like to find strings, then write the next 3 lines out to another file

exec < data.file
while read NAME NAME2 NAME3
do
if [ "$NAME2" = "dining" ]
then (how to I get the very next 3 lines?)
 

Bookmarks

Tags
linux, linux commands

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 12:58 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