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*

12
  • 1
    Your question shows multiple scripts and their actual output, but it doesn't show the input file nor the expected output for each script so it's hard to tell what it is about each of your scripts you think isn't working - we can't tell what you expected to happen from a script that doesn't do whatever it is you expected. Please edit your question to provide sample input and the expected output for whatever script(s) you think aren't behaving as expected. Commented Dec 5, 2022 at 14:17
  • 1
    FYI, cat file | awk '…' can be more succinctly written as awk '…' file Commented Dec 5, 2022 at 16:56
  • 2
    The "new situation" is that you already have an explanation for the results you originally got, but you have now added new errors, and still not fixed the previous issues. You carefully store every input line in an array for future access, but you have now removed all END block processing so the stored results are never accessed. Of your new results, the first and third are identical, and all the outcomes are correct. What else did you expect to happen? Commented Dec 7, 2022 at 15:44
  • 1
    There is no "special problem". You simply do not understand the difference between the boolean operators && and ||. Commented Dec 7, 2022 at 15:54
  • 1
    You keep throwing up scripts that produce output that looks reasonable but you think are misbehaving somehow yet you won't show us the sample input nor tell us what output you expected to get instead. Despite that you got answers to the question you asked and now you've thrown up more scripts in the same vein as your original (but may or may not contain some different question, I can't tell) and say they're somehow different but again don't provide input or expected output. Please read the answers you got to your original question and adjust your scripts per their recommendations. Commented Dec 7, 2022 at 16:09