Search Results

Search: Posts Made By: npatwardhan
Forum: Programming 02-21-2017
845
Posted By Scrutinizer
If the pattern counts if it occurs more than once...
If the pattern counts if it occurs more than once on a line, try:
awk 'NR==n{print $5} !n{c+=gsub(/aaa/,"%"); if(c>=4)n=NR+10}' file

If the pattern counts if it occurs more than once on a line...
Forum: Programming 02-21-2017
845
Posted By RudiC
Rearranging/correcting your approach as the spec...
Rearranging/correcting your approach as the spec doesn't match the data, try:
awk '/aaa/ {if (++count == 4) PRL = NR + 10} NR == PRL {print $5}' file
VALUE
Showing results 1 to 2 of 2

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