Yes! Notes! Class! Employer! It Continues!
Published on May 19, 2005 By stutefish In Life Journals
We'll come back to Unit 11. Unit 12 is shorter, and we can get it done before lunch, says the instructor.


Unit 12: Introduction To String Processing
+ head displays the first 10 lines (default) of a file.
+ tail displays the last 10 lines (default) of a file.
+ wc ("word count") counts words, lines, and characters in a file.
+ sort sorts text to stdout, on a line-by-line basis.
+ uniq filters successive duplicate lines in a file. You will need to sort a file first, in order to make all dupe lines successive.
+ cut filters specific columns of data. (By default, cut's delimiter is the TAB character.)
+ paste pastes files together.
+ tr translates characters into other characters (e.g., replacing all lower-case characters with their upper-case equivalents).

NOW WE DO SOME LABS.


Unit 11: Advanced Uses of vi (and vim)

Repositioning
+ G go to last line in file
+ 1G goto first line of file (any number can be given; nG then jumps to that line number)
+ CTRL+f go forward one full screen
+ CTRL+b go backward one full screen
+ CTRL+d go down half a screen
+ CTRL+u go up half a screen
+ H go to first line on screen ("high")
+ M go to middle of screen ("middle")
+ L go to last linen on screen ("low")
+ z ENTER make current line first on screen
+ z. make current line middle line on screen
+ z- make current line last on screen

Filtering
+ The bang filters.
+ E.g., !!date inserts the date on the current line (the second bang specifies the context, "the current line").

I now know so much vi that I can no longer tolerate typing text into this window. Why? Because I don't have access to any built-in keystroke-based editing functions. I may return to this journal later, but don't hold your breath. Goodbye, and good luck!
+

Comments
No one has commented on this article. Be the first!