Created
September 25, 2016 14:53
-
-
Save diegogslomp/159086484dabb5f3fe5de4f372405c8a to your computer and use it in GitHub Desktop.
Script to filter mac from OCS exported file and prints OFFICESCAN exported file without mac matched lines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to filter mac from OCS exported file and prints | |
# OFFICESCAN exported file without mac matched lines | |
# Need csvkit installed: pip install csvkit | |
set -e | |
OFFICESCAN="OfficeScan agent listing.csv" | |
OCS="export.csv" | |
MACLIST="ocsmaclist.tmp" | |
OUTPUT="output.tmp" | |
cp "${OFFICESCAN}" "${OUTPUT}" | |
sed 1d "${OCS}" | awk -F ";" '{print $7}' | tr ':' '-' | sed '/^$/d' > "${MACLIST}" | |
while IFS= read -r OCSMAC; do | |
sed -i "/${OCSMAC}/d" "${OUTPUT}" | |
done < "${MACLIST}" | |
csvcut -c 2,3,21,60 "${OUTPUT}" | |
rm "${MACLIST}" | |
rm "${OUTPUT}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment