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*

6
  • other answer has explanation, which part you don't understand? or you understood as you have written understand. also please don't point to a code by just giving the link to it, but also mention exact code in your question. Commented Jan 13, 2022 at 6:17
  • @αғsнιη I am almost close. I get the matched line and the next line. I don't want next line. see my updates. Commented Jan 13, 2022 at 6:25
  • x||y||z||... means "if x OR y OR z OR ... were True" then do something. x&&y&&z&&... means "if x AND y AND z AND ... all were True" then do something."True" means a result of an expression or condition evaluated true. I believe you strongly need to start first reading some basics of awk commnad. Commented Jan 13, 2022 at 6:29
  • @αғsнιη to clarify my question. to emulate rg 'Dansk|Norsk|Svenska' file3 command which return ` Subtitle: 04, Language: da - Dansk, Content: Undefined, Stream id: 0x23,` but now my awk idea return the matched line and the next line. I only want matched line. now I don't know how to improve it. Commented Jan 13, 2022 at 6:35
  • 1
    about awk '/Dansk/{a=1}/Norsk/{b=1}/Svenska/{c=1}{ if (a || b || c ) print NR, $0}' you can just do awk '/Dansk|Norsk|Svenska/{print NR, $0}', but I really don't know what are you trying to do here at all. what is your question and goal now? Commented Jan 13, 2022 at 7:01