Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

LPI101 - 5.2

Process Text Streams Using Filters

QuestionAnswer
cut Cut out (that is, print) selected columns or fields from one or more files. The source file is not changed. This is useful if you need quick access to a vertical slice of a file. By default, the slices are delimited by a tab character.
cut -blist Print bytes in list positions.
cut -clist Print characters in list columns.
cut -ddelim Set field delimiter for -f.
cut -flist Print list fields.
expand Convert tabs to spaces. Sometimes the use of tab characters can make output that is attractive on one output device look bad on another. This command eliminates tabs and replaces them with the equivalent number of spaces. By default, tabs are assumed to b
expand -tnumber Specify tab stops, in place of default 8.
expand -i Initial; convert only at start of lines.
fmt Format text to a specified width by filling lines and removing newline characters. Multiple files from the command line are concatenated.
fmt -u Use uniform spacing: one space between words and two spaces between sentences.
fmt -w width Set line width to width. The default is 75 characters.
head Print the first few lines of one or more files (the "head" of the file or files). When more than one file is specified, a header is printed at the beginning of each file, and each is listed in succession.
head -c n Print the first n bytes, or if n is followed by k or m, print the first n kilobytes or megabytes, respectively.
head -nn Print the first n lines. The default is 10.
join Print a line for each pair of input lines, one each from file1 and file2, that have identical join fields. This function could be thought of as a very simple database table join, where the two files share a common index just as two tables in a database wo
join -j1 field Join on field of file1.
join -j2 field Join on field of file2.
join -j field Join on field of both file1 and file2.
nl Number the lines of files, which are concatenated in the output. This command is used for numbering lines in the body of text, including special header and footer options normally excluded from the line numbering. The numbering is done for each logical pa
nl -b style Set body numbering style to style, t by default.
nl -f style Set footer number style to style, n by default.
nl -h style Set header numbering style to style, n by default.
nl styles A Number all lines. t Only number non-empty lines. n Do not number lines. pREGEXP Only number lines that contain a match for regular expression REGEXP.
od Dump files in octal and other formats. This program prints a listing of a file's contents in a variety of formats. It is often used to examine the byte codes of binary files but can be used on any file or input stream. Each line of output consists of an o
od -t type Specify the type of output. Typical types include: A Named character c ASCII character or backslash escape O Octal (the default) x Hexadecimal
paste Paste together corresponding lines of one or more files into vertical columns.
paste -dn Separate columns with character n in place of the default tab.
paste -s Merge lines from one file into a single line. When multiple files are specified, their contents are placed on individual lines of output, one per file.
pr Convert a text file into a paginated, columnar version, with headers and page fills. This command is convenient for yielding nice output, such as for a line printer from raw uninteresting text files. The header will consist of the date and time, the filen
pr -d Double space.
pr -h header Use header in place of the filename in the header.
pr -l lines Set page length to lines. The default is 66.
pr -O width Set the left margin to width.
sort Write input to stdout, sorted alphabetically.
sort -f Case-insensitive sort.
-kPOS1[,POS2] Sort on the key starting at POS1 and (optionally) ending at POS2.
sort -n Sort numerically.
sort -r Sort in reverse order.
sort -tSEP Use SEP as the key separator. The default is to use whitespace as the key separator.
split Split infile into a specified number of line groups, with output going into a succession of files, outfileaa, outfileab, and so on (the default is xaa, xab, etc.). The infile remains unchanged. This command is handy if you have a very long text file that
split -n Split the infile into n-line segments. The default is 1,000.
tac This command is named as an opposite for the cat command, which simply prints text files to standard output. In this case, tac prints the text files to standard output with lines in reverse order.
tail Print the last few lines of one or more files (the "tail" of the file or files). When more than one file is specified, a header is printed at the beginning of each file, and each is listed in succession.
tail -Cn This option prints the last n bytes, or if n is followed by k or m, the last n kilobytes or megabytes, respectively.
tail -nm Prints the last m lines. The default is 10.
tail -f Continuously display a file as it is actively written by another process. This is useful for watching log files as the system runs.
tr Translate characters from string1 to the corresponding characters in string2. tr does not have file arguments and therefore must use standard input and output.
unexpand Convert spaces to tabs. This command performs the opposite action of expand. By default, tab stops are assumed to be every eight spaces.
unexpand -a Convert all spaces, not just leading spaces. Normally unexpand will only work on spaces at the beginning of each line of input. Using the -a option causes it to replace spaces anywhere in the input.
unexpand -t number Specify tab stops, in place of default 8.
uniq Writes input (or stdin) to output (or stdout), eliminating adjacent duplicate lines. Since uniq works only on adjacent lines of its input, it is most often used in conjunction with sort.
uniq -d Print only non-unique (repeating) lines.
uniq -u Print only unique (non-repeating) lines.
wc Print counts of characters, words, and lines for files. When multiple files are listed, statistics for each file output on a separate line with a cumulative total output last.
wc -c Print the character count only.
wc -l Print the line count only.
wc -w Print the word count only.
xargs Execute command followed by its optional initial-arguments and append additional arguments found on standard input. Typically, the additional arguments are filenames in quantities too large for a single command line. xargs runs command multiple times to e
xargs -n maxargs Limit the number of additional arguments to maxargs for each invocation of command.
xargs -p Interactive mode. Prompt the user for each execution of command.
Created by: jtuyen
Popular Computers sets

 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards