Search Results

Search: Posts Made By: doublefrangelic
Forum: Solaris 12-07-2006
123,600
Posted By Ygor
Try...nawk...
Try...nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=2 a=4 s="string" file1...where "b" and "a" are the number of lines to print before and after string "s".
...
31,192
Posted By zazzybob
You probably won't have nawk, but you'll have...
You probably won't have nawk, but you'll have gawk - normally "awk" is hard/soft linked to gawk anyway....

which gawk
which awk
which nawk
etc... to see what you have in your path...

Cheers...
Showing results 1 to 2 of 2

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