Search
Items tagged with: SysAdmin
.@chris I’ve parsed a lot of things like this with awk / nawk / gawk.
Put multiple lines in an awk script (.awk) that match patterns and set variables.
Then after you e matched the last line, do what you want with the variables. E.g.
($1 == “Running”){
runningMode=$4
state=$7}
($1 == “Power”){
powerManagementMode=$5
print state, powerManagementMode, runningMode
runningMode=“”
state=“”
powerManagementMode=“”
}
The idea is match lines that should have known value(s) in specific field(s) and use set variables to the proper values on the matched line.
Once you see the last line (in a set) then use the variables and set the variables to default / control values.
I’ve had great success with this as a #sysadmin
This is just for an idea, all typose are my cats fault. Negative warranty provided. 😉
Does any #sysadmin have an idea how to approach this in 2024, with as little additional tools as possible?
I didn’t touch that territory for a long time so I’m not coming up with a good idea except intuitively using #awk but I feel that there should be better approaches by now.
#admin
"If a mushroom can do it, so can you."
"Networking for Systems Administrators, 2nd Edition" is now open for sponsorships. I'd appreciate your help keeping the lights on while I write this silly thing. #sysadmin
https://www.tiltedwindmillpress.com/product/n4sa2e-sponsor/
If I get 100 print backers, I'll do another challenge coin.
What sort of career advice do #sysadmin folks need?
"By providing seamless and robust computing experiences, you are depriving your organization of necessary inoculations of panic and despair. People do not believe in the need for disaster recovery until they have experienced disasters."
#DearAbyss, coming to Kickstarter later this month. https://mwl.io/ks
Ever wonder when your system last updated a package when using a Debian or Ubuntu Linux? Let's check Firefox, for example. Type this:
```
grep -B4 firefox /var/log/apt/history.log
```
See https://www.cyberciti.biz/faq/debian-ubuntu-linux-find-package-installed-updated-date/ for more info.
#debian #ubuntu #linux #sysadmin