lecture 4
Skip this Video
Download Presentation
Lecture 4

Loading in 2 Seconds...

play fullscreen
1 / 24

Lecture 4 - PowerPoint PPT Presentation

  • Uploaded on

Lecture 4. Getting data onto baboon The ASCII character code More Unix/Linux filters. Announcements. First Textools Quiz: October 6 (see review sheet). Getting data onto a machine running Linux. Scan it - scan data in and run optical character recognition (OCR) on it

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Lecture 4' - HarrisCezar

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
lecture 4

Lecture 4

Getting data onto baboon

The ASCII character code

More Unix/Linux filters

  • First Textools Quiz: October 6 (see review sheet)
getting data onto a machine running linux
Getting data onto a machine running Linux
  • Scan it -scan data in and run optical character recognition (OCR) on it
  • Copy it from a CD-Rom or floppy disk
  • Move it from another machine.
      • file transfer (ftp)
      • download data from the World Wide Web
      • email
tcp ip
  • Any given machine might run with Unix, DOS, Windows95, . . . .
  • So how can machines with different OS’s communicate?
  • through TCP/IP - a common set of rules
    • transmission control protocol (TCP) - manages data flow by breaking data into packets
    • Internet protocol (IP) - moves the data
ip addresses
IP Addresses
  • Each machine on the Internet has an official numeric address, called an IP address
  • Some MSU IP addresses





domain names
Domain Names

[email protected] baboon. montclair. edu

[email protected] homer. att. com

user ID machine institution domain


  • Enables log in to other computers from baboon

telnet sapir


Connected to sapir.

Escape character is \'^]\'.

Welcome to sapir.montclair.edu

-- Unauthorized Access Prohibited --


*ATTENTION USERS: If you cannot login to your account, please

contact the System Administrator at [email protected]



file transfer protocol ftp
File Transfer Protocol (ftp)
  • allows you to transfer files from a remote computer.
  • anonymous ftp allows you to transfer files without having an account on the remote machine.
  • Basic steps:

ftp mrcnext.cso.uiuc.edu (one gutenburg site)

login: anonymous

password: [email protected]

file compression
File Compression
  • reduces the size of a file by finding repeating patterns and substituting a variable for the pattern
  • the compress tool is called gzip
  • check out

man gzip

(q to exit)

tape archiving tar
Tape Archiving (tar)
  • tar saves multiple files to a single file, preserving the file names
  • this allows a set of files to be moved from machine to machine as one entity
  • tar also allows the restoration of the multiple files on the receiving machine
  • check out

man tar

(q to exit)

tar options
tar options

tar cffn.tar fn* create the following single file named fn.tar from

all files beginning with fn

tar xf fn.tar extract the contents of the single file restoring it as multiple files

the ascii character code
The ASCII character code.
  • The American Standard Code for Information Exchange
  • The standard for sorting used on all computers
  • To see the ASCII standard order for characters, type

man 7 ascii

(q to exit)

  • runs significantly faster than grep, but is greedy in terms of computer memory
  • egrep has several facilities that grep does not:

grep egrep

c+one or more occurrences of c No Yes

c?zero or one occurrence of c No Yes

c1|c2c1 or c2 No Yes

egrep 2
egrep (2)

egrep b+ words




egrep b? words




egrep 3
egrep (3)

egrep ‘d|f’ words



the tr command
tr transforms characters

tr expects its input to come from standard input

thus, you need a ‘<‘ to fool it into thinking the file input is actually stdin

tr from_chars to_chars < fn

refs file:

Bloomfield, L. 1933. Language.

Chomsky, N. 1986. Barriers.

Jacobson, R. 1941. Child Language.

tr o x < refs

Blxxmfield, L. 1933. Language.

Chxmsky, N. 1986. Barriers.

Jacxbsxn, R. 1941. Child Language.

The tr command
common uses of tr
Common Uses of tr
  • Case conversion

tr a-z A-Z < refs



  • Conversion of spaces to newlines

tr ‘ ‘ ‘\n’ < gettysburg





tr options
tr options

tr -s o < refsthe squeeze option

Blomfield, L. 1933. Language.

Chomsky, N. 1986. Barriers.

Jacobson, R. 1941. Child Language.

tr -c [A-z0-9] ‘ ‘ < refs

the complement option

Bloomfield L 1933 Language

Chomsky N 1986 Barriers

Jacobson R 1941 Child Language

tr options 2
tr options (2)

tr -d [0-9] < refs delete option

Bloomfield, L. . Language.

Chomsky, N. . Barriers.

Jacobson, R. . Child Language.

the sort command
The sort command
  • The sort command
    • sorts data line by line in a file
    • reads previously sorted files and merges them
    • uses the ASCII code as the default order
sort options
sort options

sort -rsort in reverse order

sort -nsort by arithmetic value

sort -nrarithmetic, reverse

sort -feliminate case distinctions

the uniq command
The uniq command
  • Operates on repeated lines
  • duplicate lines must be consecutive to be identified as duplicates (so sort often precedes uniq)
  • uniq deletes duplicate lines
  • uniq -dreports duplicate lines
  • uniq -ureports unique lines
  • uniq -creports each line with the number of times it occurred.