News for hackers. Stuff that matters.
Re:I usually run 'w' first when troubleshooting unknown mach... by thriftwy on Tuesday March 27, 2018 @07:45AM (#16687378)
I think you have dramatically different usage patterns than me. I use -o all the time. I only know -w for a limited time, but it's one of my favorite options since you can filter out a lot of garbage. You could replace it with grep -P '\bpattern\b', I guess.

I think what you are doing here is search, but -o and -w shine at data extraction and data manipulation. Things you would use Excel for, except on multiple GB files.

Re:I usually run 'w' first when troubleshooting unknown mach... by jakeogh on Tuesday March 27, 2018 @07:52AM (#16687414)
Very interesting. I'm still floundering for a use case... can you give an outline if it's difficult to make a specific example?

If you are not using search, but are using a recursive (-r) grep, then you are feeding a bunch of data to your pipe but don't care what file it came from. I get that... I mirrored the SEC's ftp back when it was ftp... and it's interesting for correlation and name stuff... but that's not going to work because it's freeform, and it's millions of small files... so you are using (large) files with a known format? Something like spectral datasets where the fields are passed with the data prefixed with it's important tags? Maybe logs?

Re:I usually run 'w' first when troubleshooting unknown mach... by thriftwy on Tuesday March 27, 2018 @08:01AM (#16687452)
As I have already said,

    grep -whor '[A-Z][A-Za-z]*Exception' * | sort | uniq -c
for a histogram of exceptions inside logs downloaded from a bunch of nodes.

As for -w, my favourite case is https://unix.stackexchange.com/questions/110645/select-lines...

As for -o,

    grep -o ........-....-....-....-............
It may look like Morse code, but what it does is greps UUIDs out.
Re:I usually run 'w' first when troubleshooting unknown mach... by jakeogh on Tuesday March 27, 2018 @08:09AM (#16687495)
Ahhh. TIL!
Re:I usually run 'w' first when troubleshooting unknown mach... by djKianoosh on Tuesday March 27, 2018 @04:20PM (#16692368)
cool stuff, i was messing around with this. To then take that list of exceptions and find them back the actual files again, tack on at the end: `| grep -Fwf - *`