Processing Text Using Filters (shell)

Ed de Jong
Slide Set by Ed de Jong, updated more than 1 year ago
Ed de Jong
Created by Ed de Jong over 2 years ago


CompTIA Linux+ Powered by LPI Slide Set on Processing Text Using Filters (shell), created by Ed de Jong on 11/11/2017.

Resource summary

Slide 1

    File-Combining Commands
    Combining Files with cat -E   display line ends -n   number lines -s   minimize blank lines -T   display special characters   Joining Files by Field with join -o FORMAT   Merging Lines with paste  
      cat first.txt second.txt > combined.txt       join listing1.1.txt listing1.2.txt join -1 3 -2 2 file1 file2     paste listing1.1.txt listing1.2.txt

Slide 2

    File-Transforming Commands (1)
    Converting Tabs to Spaces with expand -t num   (default spacing value is 8, change it with value num)   Displaying Files in Octal with od   Sorting Files with sort -f     ignore case -M   month sort -n    numeric sort -r    reverse sort order -k field   sort field
          od listing1.2.txt   sort -k 3 listing1.1.txt  

Slide 3

    File-Transforming Commands (2)
    Breaking  File into Pieces with split -b size     split by bytes -C=size    split by bytes in line-sized chunks -l lines     split by number of lines Translating Characters with tr -t    truncates SET1 to the size of SET2 -d   deletes the characters from SET1 Converting Spaces to Tabs with unexpand -t num   sets tab spacing to once every num characters Deleting Duplicate Lines with uniq  
    split -l 2 listing1.1.txt numbers   tr [options] SET1 [SET2] tr BCJ bc < listing1.1.txt tr - sort longtext.txt | uniq  

Slide 4

    File-Formatting Commands (1)
    Reformatting Paragraphs with fmt -width, -w, width, --width=width Numbering Lines with nl -b style       body numbering style -h style       header and footer numbering style -f style                     "                        " -d=code     page separator -p                line-number options for new pages -n format   number format Style codes: t, a, n, pREGEXP  
        nl -b a buggyprog > numbered-buggyprog.txt  

Slide 5

    File-Formatting Commands (2)
    Preparing a File for Printing with pr -numcols  generate multicolumn output -d               generate double-spaced output -F, -f           use form feeds -l                set page length -h text      set the header text -t               omit header -o chars   set left margin and page width
    pr myfile.txt pr -3 myfile.txt cat -n /etc/profile | pr -d | lpr cat -n /etc/profile | pr -dfl 50 | lpr

Slide 6

    File-Viewing Commands
    Viewing the Starts of Files with head -c num   specify the number of bytes -n num   specify the number of lines   Viewing the Ends of Files with tail -f                  track a file --pid=pid     stop tracking on program termination   Paging through Files with less  

Slide 7

    File-Summarizing Commands
    Extracting Text with cut -b lists   by byte -c lists   by character   Obtaining a Word Count with wc -l, -w, -c, -m   limit to newline, words, bytes, characters count -L                     maximum line lenght
      ifconfig eth0 | grep HWaddr | cut -d " " -f 11     wc file.txt
Show full summary Hide full summary


Components of An Operating System - Jason Madappattu
Jason EM
Linux - File Permissions
Mitch Isaacs
Linux Programming Interface: Chapter 1
Jon Schipp
Quantum Mechanics
Christopher Boga
Chinua Achebe's "How the Tortoise Cracked his Shell"
Carolyne Hess
RedHat Linux Version 7 System Administration Certification
John Sweet
Sebastian Molina
Fen Pin
3. Сокеты Беркли. Мультиплексирование.
Sergei Fomin
Jak Salad
Linux Programming Interface: Chapter 2
Jon Schipp