Search Results

Search: Posts Made By: Franklin52
18,992
Posted By Franklin52
Strange, this: awk...
Strange, this:
awk '/one/{f=1;x=NR}f{A[++c]=$0}END{while(++d<x)print A[d]}' input

works fine on a HP-UX machine but not on my Debian box with gawk :eek:
18,992
Posted By Franklin52
@ctsgnb, The command also prints the line...
@ctsgnb,

The command also prints the line after the last regex.
Shouldn't it be?
awk '/one/{f=1;x=NR}f{A[++c]=$0}END{while(++d<x-1)print A[d]}' input

Another approach:
awk '/xyz/{if(s){print...
18,992
Posted By Franklin52
Another one with awk: awk 'f &&...
Another one with awk:
awk 'f && /one/{print;exit}/one/{f=1}f' file
Showing results 1 to 3 of 3

 
All times are GMT -4. The time now is 08:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy