Skip to content

Instantly share code, notes, and snippets.

@jschaub30
Created April 29, 2015 15:07
Show Gist options
  • Save jschaub30/ab44ce1be4d93a2603d1 to your computer and use it in GitHub Desktop.
Save jschaub30/ab44ce1be4d93a2603d1 to your computer and use it in GitHub Desktop.
Bash script to process file line by line
#!/bin/bash
# Input = CSV file with timestamp as 3rd field
# 1,2,Wed Apr 29 09:46:58 CDT 2015
# 3,4,Wed Apr 29 09:46:58 CDT 2015
# Converts timestamp to linux time
while read line
do
A=$(echo $line | cut -d, -f1-2)
D=$(echo $line | cut -d, -f3)
D=$(date -d "$D" +"%s")
echo $A,$D
done < "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment