CS462 Visual Arts: Key Terms & Definitions Study Set

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/26

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

27 Terms

1
New cards

What does VIM stand for?

VIsual editor iMproved

2
New cards

Why is VIM so popular?

it's very lightweight, free, and has many shortcuts for ease of use (who needs a mouse!)

3
New cards

What are the 3 modes of VIM?

Command/Window, Insert, and Line Command

4
New cards

Command/Window Mode VIM

where we can execute commands

- basic cursor motions, screen control, word commands, deletions, etc.

5
New cards

Character Insert Mode VIM

where text can be entered

- use many different letters to enter: i - insert before; o - on the next line, a - insert after, O - previous line

6
New cards

Line Command Mode VIM

where ex or ed commands can be issued

7
New cards

gvim

VIM with a GUI; need X11 forwarding to work on agora

8
New cards

Enhanced for

for in ; do

commands

done

- can use break or continue in a loop as well; break causes you to leave the loop, continue goes to next iteration

9
New cards

Arrays

declared like x=("lemur" "dog" "cat")

- read x[7] x[9] to store elements in array

- to display echo ${x[0]} -> lemur

- echo${#x[@]} to see amount of elements in array

10
New cards

Functions

declared like:

list()

{

first=$1

mid=$2

last=$3

strange="What is my scope" // global

local foo="huh" // local to function

}

- $1/2/3 are all parameters

11
New cards

awk

awk -[Fc] 'script' [files] ...

awk -[Fc] -f scriptfile [files]...

-Fc - c is a character to act as a field separator; default of space and tab

-f - defines a script file to use

uses pattern {procedure}; if no pattern is given procedure applied to everyline. if no procedure is given, outputs matched pattern to stdout

12
New cards

awk patterns

- /regular expressions/

- /D[Rr]\./ -> matches Dr. or DR. on any line

- relational expressions

- $0 is entire line

- $n means nth field

- NF is number of fields in current line

- NR is the number of the current line

- pattern matching expression

- $1 == 'if' is if the first field is 'if'

- $1 == $2 is if the first field matches the second

- NR > 100 have I processed 100 lines?

- /if/ && /

13
New cards

awk procedures

- specifies the processing of a line that matches a given pattern

- contained with { } and consists of commands separated by semicolons or newlines

ex:

- { print $1, $2 } # prints first 2 fields of each line

- BEGIN {sum=0}

{sum += 1} # sums values of fields in first column

END{print sum} # and prints the sum

14
New cards

tr

character translator filter; common use to replace one character for another

- reads stdin and writes stdout

forms:

tr str1 str2 # replace str1 with corresponding char in str2

tr -d string # delete all occurrences of characters in the string

tr -s str1 str2 # replace instances of repeated chars in str1 w/

# single char in str2

ex:

- tr "[a-z]" "[A-Z]" # lower -> upper

- tr -s "\t" "\t" # squeeze consecutive tabs to a single tab

- tr -d '\015' # delete carriage returns

15
New cards

sort

sort or merge lines of text or records

- default sorts be characters

-n - sort by numerics

-t - change field separator (-t: changes to :)

-b - ignores blank space

-r - reverse order

-kn - sorts by the nth field

sort -k3,k3 -k1 file.txt - sorts by 3rd field then stops and goes to 1st field

16
New cards

fmt

puts specified amount of characters line by line

ex: fmt -#

-# - number of characters per line; default of 65

17
New cards

head

looks at the beginning lines of a file

- head (default of 10 lines)

-# - number of lines to show

18
New cards

tail

shows the last lines of a file

- tail (default of 10 lines)

-# - number of lines to show

-f - monitors the end of a file; updates as you add to the end of a file (WITH RETRY)

-F - if iNode detaches it'll go and find it for the new one; so it updates on edits (WITHOUT RETRY)

19
New cards

basename

when given a path to a file, returns the name of the file

basename .extension - returns the file w/o extension

-a - basename of all *.extension files

-s .ext - removes the file extensions

20
New cards

dirname

when given a path to a file, returns the path to the file

21
New cards

cut

allows you to select fields from files

-d - set field separator/delimeter for file

-f# - number of the field to

cut -d " " -f1 -> gets first field from file

cut -d " " -f2,4 -> fields 2 and 4

cut -d " " -f2-4 -> fields 2 through 4

22
New cards

paste

merges corresponding or subsequent lines of files

-dx -> sets x as the delimeter between values in output

paste -d " " file1.txt file2.txt -> merges two files together and print to stdout

23
New cards

sed

stream editor

- sed "script" [file]...

- sed -e "script" [ -e "script" ]... [file]....

- applies n scripts to n files

- sed -f scriptFile [file]...

flags:

-e - specifies to use a script (also to use multiple scripts)

-f - specifies to use a script file

-E - regex extended (POSIX compliant)

ex: sed "50d" file.txt -> delete file 50 from file.txt

24
New cards

Line address Commands in sed

n - absolute line number n

i,j - range from lines i to j

- can also use . for current line and $ for last line

+ - go forwards one line

- - go backwards one line

+n - go forwards n lines

-n - go backwards n lines

ex: 1,$ is the entire file

25
New cards

Line editing commands

addr - go to address

[addr] 1 - print lines to stdout

/ - go to first line matching the pattern

? - go to last line matching the pattern

[addr] a text - add text to line after address

[addr] i text - add text to line before address

[addr] d - delete line at address

[addr] c text - replace text at address

[addr] s pat1/pat2 - replace pattern 1 with pattern 2 at address

& - what you match

/g - every occurrence on a single line

ex:

/^#/d - delete comments that are at the start of the line

/Smith/,$d - delete from first line with Smith to the end

26
New cards

sed examples

s/[A-Z][A-Z][A-Z]*/"&"/g

- quote every instance of 2 or more characters in a file

s/[A-Z][A-Z][A-Z]*/"&"/2

- same as above, only the second occurrence per line

27
New cards

applying multiple commands in sed

can use { } to practically define a function

ex:

/^

    /,/^<\/ul>/{

s/^

    /
      /

s/^

  • /

  • /
  • s/^<\/ul>/<\/ol>/

    } -> replace all of the following inside of

      and