Search
Items tagged with: sysadmin
Scumbag crontab. At least on two times I messed up cyberciti.biz/faq/how-do-i-add…
#linux #unix #macos #sysadmin #opensource
.@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