Created
April 29, 2015 15:07
-
-
Save jschaub30/ab44ce1be4d93a2603d1 to your computer and use it in GitHub Desktop.
Bash script to process file line by line
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 | |
# 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