Untitled
#!/bin/bash branch_build_time=$(uname -v| awk '{print $4" "$5" "$6" "$7" "$9}') parsed_branch_build_time=$(echo "$branch_build_time" | awk '{print $6, $2, $3, $4}' | awk '{printf "%s-%s-%s %s\n", $1, $2, $3, $4}') parsed_branch_build_time1=$(echo "$branch_build_time" | awk ' BEGIN {month_map["Jan"]="01"; month_map["Feb"]="02"; month_map["Mar"]="03"; month_map["Apr"]="04"; month_map["May"]="05"; month_map["Jun"]="06"; month_map["Jul"]="07"; month_map["Aug"]="08"; month_map["Sep"]="09"; month_map["Oct"]="10"; month_map["Nov"]="11"; month_map["Dec"]="12"} {print $6, month_map[$2], $3, $4}' | awk '{printf "%s-%s-%s %s\n", $1, $2, $3, $4}') echo $parsed_branch_build_time1
Leave a Comment