Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IT Support Engineer Assignment from Kevin #1927

Open
kevin6668888 opened this issue Jun 15, 2023 · 0 comments
Open

IT Support Engineer Assignment from Kevin #1927

kevin6668888 opened this issue Jun 15, 2023 · 0 comments

Comments

@kevin6668888
Copy link

kevin6668888 commented Jun 15, 2023

#bash for mac
#!/bin/bash
gzip -d interview_data_set.gz
grep "ERROR" interview_data_set | awk '{print "{"deviceName":""$2"","processId":""$5"","processName":""$6"","description":""$9"","timeWindow":""$1"-"$2"","numberOfOccurrence":1}"}' | curl -X POST -H "Content-Type: application/json" -d @- https://foo.com/bar

#powershell for windows
Get-Content .\interview_data_set.gz | gzip -d | Select-String ERROR | ForEach-Object { $line = $_.ToString().Split(" "); $json = @{ "deviceName"=$line[1]; "processId"=$line[4]; "processName"=$line[5]; "description"=$line[8..($line.count-1)] -join " "; "timeWindow"=$line[0]+"-"+$line[1]; "numberOfOccurrence"=1 } | ConvertTo-Json; Invoke-RestMethod -Uri https://foo.com/bar -Method Post -Body $json -ContentType "application/json" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant