![]() |
|
|
grep unix.com with google
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Our Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
![]() |
|
|
Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|||
|
Code:
while(<DATA>){
$n++ if /COD1/;
if ($n == 3){
print $.;
exit;
}
}
__DATA__
COD1
COD2
COD2
COD1
COD2
COD2
COD1
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script to find the number of tab delimiters in a line | poornimajayan | UNIX for Dummies Questions & Answers | 5 | 09-29-2008 11:36 AM |
| echo a line number when script is executing | gavineq | UNIX for Dummies Questions & Answers | 1 | 06-20-2008 05:11 PM |
| Adding a columnfrom a specifit line number to a specific line number | Ezy | Shell Programming and Scripting | 2 | 05-12-2008 09:29 AM |
| Appending line number to each line and getting total number of lines | chiru_h | Shell Programming and Scripting | 2 | 03-25-2008 10:19 AM |
| Unix Script with line number at beginning of each line. | mascorro | Shell Programming and Scripting | 5 | 06-19-2006 05:34 PM |