Bracket Expressions and Character Classes................................................................................220
Negation..................................................................................................................220
Traditional Character Ranges......................................................................................220
POSIX Character Classes............................................................................................221
POSIX Basic vs. Extended Regular Expressions...........................................................................224
Alternation.............................................................................................................................225
Quantifiers.............................................................................................................................226
?—Match an Element Zero Times or One Time..............................................................226
*—Match an Element Zero or More Times....................................................................227
+—Match an Element One or More Times....................................................................227
{ }—Match an Element a Specific Number of Times.......................................................228
Putting Regular Expressions to Work.........................................................................................229
Validating a Phone List with grep.................................................................................229
Finding Ugly Filenames with find.................................................................................230
Searching for Files with locate.....................................................................................230
Searching for Text with less and vim............................................................................231
Final Note..............................................................................................................................232
20
TEXT PROCESSING 233
Applications of Text.................................................................................................................234
Documents................................................................................................................234
Web Pages...............................................................................................................234
Email........................................................................................................................234
Printer Output............................................................................................................234
Program Source Code................................................................................................235
Revisiting Some Old Friends.....................................................................................................235
cat—Concatenate Files and Print on Standard Output....................................................235
sort—Sort Lines of Text Files........................................................................................236
uniq—Report or Omit Repeated Lines...........................................................................242
Slicing and Dicing..................................................................................................................243
cut—Remove Sections from Each Line of Files................................................................243
paste—Merge Lines of Files.........................................................................................246
join—Join Lines of Two Files on a Common Field...........................................................247
Comparing Text......................................................................................................................249
comm—Compare Two Sorted Files Line by Line.............................................................249
diff—Compare Files Line by Line..................................................................................250
patch—Apply a diff to an Original..............................................................................253
Editing on the Fly....................................................................................................................254
tr—Transliterate or Delete Characters...........................................................................254
sed—Stream Editor for Filtering and Transforming Text...................................................256
aspell—Interactive Spell Checker.................................................................................263
Final Note..............................................................................................................................266
Extra Credit............................................................................................................................266
xvi
Contents in Detail
www.it-ebooks.info