A Unix machine’s hostname appears at the shell prompt, and is also the name used many of the networking pro-grams to identify the machine.
- To see what the hostname is set to:
- $ hostname
- And to change it:
- $ hostname new_name_here
A Unix machine’s hostname appears at the shell prompt, and is also the name used many of the networking pro-grams to identify the machine.
Damned Americans and their illogical data formats…trying to import a 100MB file into MySQL, and the date fields are in MM/DD/YYYY instead of the traditional YYYY/MM/DD that we all know and love…so I turned my hand to sed:
First, a quick test on the command line:
echo “MM/DD/YYYY” | sed -e “s_\(..\)\/\(..\)\/\(….\)_\3/\1/\2_”
=> YYYY/MM/DD
echo “textbeforeMM/DD/YYYYtextafter” | sed -e “s_\(..\)\/\(..\)\/\(….\)_\3/\1/\2_”
=>textbeforeYYYY/MM/DDtextafter
Then let’s let it loose on the file itself:
sed -e “s_\(..\)\/\(..\)\/\(….\)_\3/\1/\2_” test_in.csv > test_out.csv
Took a few seconds to run against a 100MB file 🙂
Many thanks to Bruce Barnett for his Sed – An Introduction and Tutorial , an invaluable reference for a neophyte like me 🙂