The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
Search text from a file and print text and one previous line too
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
Search text from a file and print text and one previous line too
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
6
(
permalink
)
01-05-2009
kamranjalal
Registered User
Join Date: Oct 2008
Posts: 9
Hi,
Command awk '/pattern/{print s "\n" $0;exit}{s=$0}' file only returns the first occurance of the pattern, it is not showing the next occurance.
Please help me, thanks
kamranjalal
View Public Profile
Find all posts by kamranjalal
Find kamranjalal's past nominations received
Find kamranjalal's present nominations given