Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exists 4 times or more

Status
Not open for further replies.

ng1

Technical User
Aug 22, 2007
39
US
I have a file like this:

111 aa 100.00
111 aa 205.00
totals 2 205.00
111 292.00
111 355.00
222 aa 350.00
totals 1 350.00
222 698.00
3333 aa 497.00
3333 aa 100.00
totals 2 597.00

I want to only print the records that have $1 show up at least 4 times. In this case, I would want to print:

111 aa 100.00
111 aa 205.00
totals 2 205.00
111 222.00
111 355.00

How would I do this? Thanks.
 
What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I tried this:

{
if ($1 ~ /^[0-9]+$/)
i=$1

while (i >= 4) {print $0}
}


but it just kept printing the first field over and over again until I stopped it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top