4 ms·
> Quick, easy. In a *nix shell that would be very tricky. You'd probably need to make an explicit SQL query since you wouldn't have the database integration.
by schoen 10y ago
> Quick, easy. In a *nix shell that would be very tricky.
You'd probably need to make an explicit SQL query since you wouldn't have the database integration.
- PeCaN 10y agoWell, yeah, but I mean the concept (grepping in tabular data). If, hypothetically, bash had database integration, ls Columns would probably return something like foo varchar 30 NOT NULL bar decimal 8 baz int 4 Which would be a royal PITA to search for anything in—if I were to search for ‘int’ I'd get all int columns and any columns with int in the name…. I could've used an example involving process lists, but I didn't want to trigger PTSD in anyone who's had to grep the output of ‘ps’ for anything non-trivial. (Plus, the database thing was something I actually did a few days ago.)
- stepvhen 10y agoBut thats why there are tools like awk.
- PeCaN 10y agoawk is rather similar in many ways to powershell, actually, but untyped. I agree most of what powershell does you can do with awk, but it's often less pleasant than powershell (in my experience).
- firethief 10y agops aggregates /proc info for human viewing. Why grep the formatted output rather than the source data?
- PeCaN 10y agoMaybe on Linux. OpenBSD doesn't even have procfs, FreeBSD deprecated it, DragonFlyBSD doesn't mount it by default. /proc is a race condition waiting to happen, so I can't really say I recommend using that.