Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 1
    What have you tried so far? Commented Nov 5, 2019 at 20:37
  • I have tried the following script: "{print "Number of fields in record #" NR " containing 'he': " index($0, "he")} and it doesn't work. I also tried gsub, but gsub counts every occurrence of 'he', not just the fields in which 'he' is found. Commented Nov 5, 2019 at 20:39
  • 1
    You need to iterate over the fields. This should help you. Commented Nov 5, 2019 at 20:42
  • 1
    Have you abandoned unix.stackexchange.com/questions/550529/… ? Commented Nov 5, 2019 at 20:45
  • @JohnMike also, please put your attempts & their results into your question, where they won't be overlooked. Commented Nov 5, 2019 at 20:46