Skip to main content
13 events
when toggle format what by license comment
Jan 13, 2022 at 7:02 vote accept jian
Jan 13, 2022 at 7:01 comment added αғsнιη 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?
Jan 13, 2022 at 6:58 history edited jian CC BY-SA 4.0
update with NR.
Jan 13, 2022 at 6:36 comment added αғsнιη you changed your command and now you are expecting to see the same result as rg returns?! no, you are going in wrong way. In one of your previous question I answered what does 1 means in awk, but sounds you didn't learn it. you need improve your reading
Jan 13, 2022 at 6:35 comment added jian @αғ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.
Jan 13, 2022 at 6:29 comment added αғsнιη 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.
Jan 13, 2022 at 6:25 comment added jian @αғsнιη I am almost close. I get the matched line and the next line. I don't want next line. see my updates.
Jan 13, 2022 at 6:20 history edited jian CC BY-SA 4.0
update file3 content.
Jan 13, 2022 at 6:17 comment added αғsнιη 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.
Jan 13, 2022 at 6:13 history edited jian CC BY-SA 4.0
add more context (https://stackoverflow.com/a/22497489/15603477) to this question.
Jan 13, 2022 at 5:57 answer added αғsнιη timeline score: 1
Jan 13, 2022 at 5:35 history edited schrodingerscatcuriosity CC BY-SA 4.0
deleted 28 characters in body
Jan 13, 2022 at 5:29 history asked jian CC BY-SA 4.0