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*

4
  • Yes, this totally worked! i got what I wanted!!!! [root@priti ]$ cat stats_2022102118.log | awk -F';' '{ for(i=1; i<=NF; i++){ if ($i ~ /^creq_recv=/) { print $i}}}' creq_recv=0 creq_recv=0 creq_recv=0 creq_recv=0 Commented Oct 21, 2022 at 11:42
  • 1
    @PritiPatel no need to cat. If you don't want tail -f to watch the file, just give the file to awk directly: awk -F';' '{...}' stats_2022102118.log. But, really, the grep approach is simpler. Commented Oct 21, 2022 at 12:00
  • The |; in grep -oP '(?=^|;)creq_recv=[^;]+' does not make sense, creq_recv will never start with ;, it will always start with c. ITYM (?<= instead of (?= Commented Oct 26, 2022 at 17:17
  • Argh! Of course I do, @StéphaneChazelas, thanks! Commented Oct 26, 2022 at 19:05