I have not found any very good, simple introductions to unix and the command line. For the purpose of this class, I'm going to outline how to do some very simple operations. I think the best way to learn is directly from someone else - watch over someone's shoulder in lab or when working with a group, and ask "How did you do that?" when you see something that you want to know. Feel free to e-mail questions to Adam. Starting IRAFOn the cosmos machines, you need to be in a terminal (most likely an "xterm") to access IRAF and most useful commands. To do this, right-click on the desktop, navigate to the "Tools" menu, and click "Terminal." To access IRAF, you need to open an xgterm (X graphics terminal). Type "xgterm &" and press enter. If you have never used iraf before, you need to create a login.cl file in your home directory. This can be done by running the "mkiraf" script. Type "mkiraf" and press enter. IRAF needs to run from within a c shell (csh), and while this should happen automatically, it doesn't hurt to be sure. Type "csh" and press enter. Finally, to open IRAF, type "cl" and press enter. You should now be at an IRAF cl> prompt. Opening .tar filesTo make downloading a large number of files simpler, we put them into a tar archive file. "tarballs" are similar to zip files on windows and are an effective way to put a whole folder into a single file. To extract a tar file, use the command tar -xf (filename) If there is a .tgz or .tar.gz file, you can use the command tar -xzf (filename.tar.gz) or gunzip (filename.tar.gz) tar -xf (filename.tar) General UNIX instructionsAmy Bender included some UNIX introductions on her ASTR 3510 page: Brian Keeney's Introduction to Unix (pdf) Amy Bender's Introduction to Unix (ps) I'm also a fan of Josh Walawender's Introduction to Unix (pdf) Understanding SED:There are many worthwhile advanced unix tools, my favorite being sed, the stream editor, awk, and perl. SED takes lines of text and applies specified edits to them before they are output. AWK similarly runs through lines of text, but is more flexible and complicated. Perl is a programming language that is significantly more powerful than awk and sed, but it requires a little learning to use and is not good for one-liners. However, it is probably the easiest beginner programming language - it is relatively tolerant of being imprecise.What does the command !sed -e 's/\.FIT/\.fits/g' list_fit > list_fits do?
sed is the command -e is an optional parameter that is not strictly necessary in this case, it allows you to specify an expression 's/\.FIT/\.fits/g' is the meat of the code, it is a regular expression.
/\.FIT/ specifies the first string. The /'s specify the boundary of the expression. \ is the escape operation, it is needed because . is treated as a wildcard otherwise Similarly,/\.fits/ specifies the second string. g means every occurence of the first string on the line will be replaced, not just the first occurrence > redirects your output to the second file list_fits is your target file with .fits images listed where .FIT were listed previously Getting started with SED SED reference Pat Hartigan's SED page Pat Hartigan's AWK page A brief description of the sudo command |