More Examples
We can extract data about ATL to ORD flights.
First navigate to the Data Expo 2009 directory:
cd /depot/statclass/data/dataexpo2009/
We can find all of the flights that departed from Atlanta
and arrived at O'Hare, and save them in a file:
grep ATL,ORD 2005.csv >AtlantaToChicago.txt
There are 8324 lines in the AtlantaToChicago.txt file.
We can tell this by checking the number of lines in this file,
using the wc command:
wc AtlantaToChicago.txt
This gives the number of lines, words, and characters.
Since each line has no spaces, this means that it treats each line as a word,
only in this case. It is useful for other applications too.
If we only want to see the number of lines, we can use the -l flag:
wc -l AtlantaToChicago.txt
The last 10 lines that you typed are accessible from:
history | tail
If you want to temporarily make a directory and then remove it,
we can do that:
mkdir tempstuff
and then we can see that it exists:
ls
and then we can throw it away:
rmdir tempstuff
Similarly, we can rename the AtlantaToChicago.txt file:
mv AtlantaToChicago.txt myfile.txt
or even make a copy:
cp myfile.txt backup.txt
and we can just throw one of these away:
rm myfile.txt
but we still have the backup. Here are its contents:
cat backup.txt