CNIT 340 Strings and Text

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/58

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.

59 Terms

1
New cards

what does cut do?

cuts data from a file or piped stdout

2
New cards

what does the paste command do?

puts two lines together

3
New cards

how do you set the delimiter in the paste command?

using the -d option

4
New cards

how is output of cut redirected?

> or |

5
New cards

cut -c only works for fixed length fields (t/f)

true

6
New cards

how can you specify the field number with the cut command?

-f

7
New cards

text and file contents do not need filtering/reformatting before being used (t/f)

false

8
New cards

what are some reformatting/filtering commands

head

tail

grep

tr

sort

uniq

9
New cards

head is a derivative of which basic command?

cat

10
New cards

what does head do?

prints out first n lines of a file to stdout

11
New cards

what is the default value of n in head?

10

12
New cards

what is the syntax of head?

head -n # filename1

ex: head -n /etc/resolv.conf

13
New cards

what is tail a derivative of?

cat

14
New cards

tail is the opposite of what command?

head

15
New cards

what does the head command do?

print out the last n lines of a file to stdout

16
New cards

what is the default value of n in tail?

10

17
New cards

what is the syntax of tail?

tail -n # filename

ex: tail -n /var/log

18
New cards

the tail command supports piping (t/f)

false

19
New cards

what does grep stand for?

globally regular expression print

20
New cards

what does grep do?

sends lines with a regex search term to stdout

21
New cards

what does the tr command mean?

transliterate

22
New cards

what does the tr command do?

translates characters in a standard input stream

23
New cards

how are characters translated in tr command?

with a pipe or < (read input from file)

24
New cards

tr can use regular expressions as parameters (t/f)

true

25
New cards

tr can use octal values of ASCII chars for paramters (t/f)

true

26
New cards

what does the -s option do in the tr command?

replace repeated characters

27
New cards

what does the -d option do in the tr command?

delete charaters

28
New cards

tr cannot use character classes as parameters (t/f)

false

29
New cards

character classes can be thought of as regular expressions (t/f)

true

30
New cards

what are some common character classes?

alpha

lower

upper

digit

alnum

cntrl

punct

31
New cards

what does the sort command do?

reorderrs lines in alphabetical order

32
New cards

does uppercase or lowercase come first in the output of a sort command?

uppercase

33
New cards

what does the -u option do for the sort command?

removes all duplicate entires in the output

34
New cards

what does the -n option do for the sort command?

sorts a numeric list

35
New cards

what does the -r option do for the sort command?

sorts the list in reverse order

36
New cards

what does uniq command do?

removes consecutive repeated lines

37
New cards

uniq can provide a count of unique words (t/f)

true

38
New cards

what are the two methods for string processing?

expr

${}

39
New cards

expr is an external command (t/f)

false, it is internal

40
New cards

${} is internal to the bash shell (t/f)

true

41
New cards

what will return the length of the string?

${#}

42
New cards

what will return the number of elements in an array?

${#VAR[@] }

43
New cards

what will return the remaining substring of a string as a specific position?

${:}

44
New cards

what will return teh substring of string length at a specific position?

${::}

45
New cards

what does ${#} do?

returns the SHORTEST match of substring from the FRONT of string

46
New cards

what does ${##} do?

returns the LONGEST match of substring from the FRONT of string

47
New cards

what does ${%} do?

returns SHORTEST match of substring form the BACK of string

48
New cards

what does ${%%} do?

returns the LONGEST match of substring from the BACK of string

49
New cards

what does ${//} do?

returns string with the FIRST match of substring replaced by replacement

50
New cards

what does ${///} do?

return string with ALL matches of substring replaced by replacement

51
New cards

what does ${/#/} do?

if substring matches the FRONT of string, return string with substring replaced by replacement

52
New cards

what does ${/%/} do?

if substring matches the BACK of string, return string with substring replaced by replacement

53
New cards

what does expr match do

returns the length of the matching at the beginning of

54
New cards

what does expr index do

returns position in string of the first char of matching substring

55
New cards

what does expr substr do

returns length characters from string starting at position

56
New cards

bash supports regex comparison (match) operator =~ in what type of test?

double bracket [ [ ] ]

57
New cards

when using BASH built in REGEX functions, you can extract strings with () (t/f)

true

58
New cards

BASH_REMATCH is an arry (t/f)

true

59
New cards

what happens if BASH_REMATCH has no index?

reuslt of all matches put together