OPTION EXAMPLE$

Free download. Book file PDF easily for everyone and every device. You can download and read online OPTION EXAMPLE$ file PDF Book only if you are registered here. And also you can download or read online all Book PDF file that related with OPTION EXAMPLE$ book. Happy reading OPTION EXAMPLE$ Bookeveryone. Download file Free Book PDF OPTION EXAMPLE$ at Complete PDF Library. This Book have some digital formats such us :paperbook, ebook, kindle, epub, fb2 and another formats. Here is The CompletePDF Book Library. It's free to register here to get Book file PDF OPTION EXAMPLE$ Pocket Guide.

For more control over sorting, the -k option allows you to specify the field to sort on, and the -t option lets you choose the field delimiter. If -t is not specified, then fields are separated by whitespace and leading and trailing whitespace in the record is ignored. With the -t option, the specified character delimits fields, and whitespace is significant.

Thus, a three-character record consisting of space-X-space has one field without -t , but three with -t ' ' the first and third fields are empty. The -k option is followed by a field number, or number pair, optionally separated by whitespace after -k. If only one field number is specified, the sort key begins at the start of that field, and continues to the end of the record not the end of the field.

If a comma-separated pair of field numbers is given, the sort key starts at the beginning of the first field, and finishes at the end of the second field. With a dotted character position, comparison begins first of a number pair or ends second of a number pair at that character position: -k2. If the start of a sort key falls beyond the end of the record, then the sort key is empty, and empty sort keys sort before all nonempty ones. When multiple -k options are given, sorting is by the first key field, and then, when records match in that key, by the second key field, and so on.

While the -k option is available on all of the systems that we tested, sort also recognizes an older field specification, now considered obsolete, where fields and character positions are numbered from zero. If the character position is omitted, it defaults to zero. For more control, add a modifier letter in the field selector to define the type of data in the field and the sorting order.

Here's how to sort the password file by descending UID:. A more precise field specification would have been -k3nr,3 that is, from the start of field three, numerically, in reverse order, to the end of field three , or -k3,3nr , or even -k3,3 -n -r , but sort stops collecting a number at the first nondigit, so -k3nr works correctly. The useful -u option asks sort to output only unique records, where unique means that their sort-key fields match, even if there are differences elsewhere. Reusing the password file one last time, we find:. Notice that the output is shorter: three users are in group , but only one of them was output Sometimes you need to sort data composed of multiline records.

A good example is an address list, which is conveniently stored with one or more blank lines between addresses. For data like this, there is no constant sort-key position that could be used in a -k option, so you have to help out by supplying some extra markup. Here's a simple example:. The sorting trick is to use the ability of awk to handle more-general record separators to recognize paragraph breaks, temporarily replace the line breaks inside each address with an otherwise unused character, such as an unprintable control character, and replace the paragraph break with a newline.

A filter step downstream from sort restores the line breaks and paragraph breaks, and the sort key lines are easily removed, if desired, with grep. The entire pipeline looks like this:. The gsub function performs "global substitutions. The RS variable is the input Record Separator. Normally, input records are separated by newlines, making each line a separate record.

This is exactly the form of our input data. More detail on these constructs may be found in Chapter 9. The beauty of this approach is that we can easily include additional keys in each address that can be used for both sorting and selection: for example, an extra markup line of the form:. You could, of course, go overboard and use XML markup to identify the parts of the address in excruciating detail:. With fancier data-processing filters, you could then please your post office by presorting your mail by country and postal code, but our minimal markup and simple pipeline are often good enough to get the job done.

The obvious way to sort data requires comparing all pairs of items to see which comes first, and leads to algorithms known as bubble sort and insertion sort. These quick-and-dirty algorithms are fine for small amounts of data, but they certainly are not quick for large amounts, because their work to sort n records grows like n 2. This is quite different from almost all of the filters that we discuss in this book: they read a record, process it, and output it, so their execution time is directly proportional to the number of records, n.

The Unix sort command implementation has received extensive study and optimization: you can be confident that it will do the job efficiently, and almost certainly better than you can do yourself without learning a lot more about sorting algorithms. An important question about sorting algorithms is whether or not they are stable : that is, is the input order of equal records preserved in the output? A stable sort may be desirable when records are sorted by multiple keys, or more than once in a pipeline. POSIX does not require that sort be stable, and most implementations are not , as this example shows:.

The sort fields are identical in each record, but the output differs from the input, so sort is not stable. Fortunately, the GNU implementation in the coreutils package [1] remedies that deficiency via the -- stable option : its output for this example correctly matches the input. Here's a convenient way of finding those space hogs in your home directory can be any directory. For me, those large files are usually a result of mkfile event testing purposes and can be promptly deleted. Here's an example of its use. In the following examples, first the preferred and then the obsolete way of specifying sort keys are given as an aid to understanding the relationship between the two forms.

Either of the following commands sorts the contents of infile with the second field as the sort key:. Either of the following commands sorts, in reverse order, the contents of infile1 and infile2 , placing the output in outfile and using the second character of the second field as the sort key assuming that the first character of the second field is the field separator :. Either of the following commands sorts the contents of infile1 and infile2 using the second non-blank character of the second field as the sort key:.

Either of the following commands prints the passwd 4 file user database sorted by the numeric user ID the third colon-separated field :. Either of the following commands prints the lines of the already sorted file infile , suppressing all but one occurrence of lines having the same third field:. Either of the following commands prints the hosts 4 file IPv4 hosts database , sorted by the numeric IP address the first four numeric fields :. Since '. For the large majority of applications, treating keys spanning more than one field as numeric will not do what you expect.

To achieve this, we will use sort, the unix sorting tool. A much more complicated sort can be achieved. For example, we can sort using the shell in a first step then sort using the geco:. You have a file with some people you lend money and the amount of money you gave them. Just type. The following are modification parameters: -b jumps over leading whitespaces -d dictionary sort just using letters, numbers and whitespace -f ignores case distinction -n sort numerically -r reverse order.

The term sorting, strictly speaking, really means to separate things into different categories. For example, you might sort clothes for washing into light and dark colors. In computer jargon, though, when we say we are sorting data, we really mean that we are ordering it, that is, putting records in order according to their contents. For example, we might write a program to sort the entries in an address book into alphabetical order. The sort utility reads a stream of records and outputs the records in order according to one or more sort keys, that is, according to part or all of the contents of each record.

Input and output streams If sort is executed without any arguments, it reads a stream of lines from its standard input, sorts them in order by the ASCII codes of all the characters from left to right, and writes the sorted stream to the standard output. You may also specify one or more input files as arguments to sort. This example would sort three files named moe, larry and curly, and call the output file stooges:.

You can ask sort to write to a specific file by using the -o option, followed by a space and then the name of the desired output file. This command would work just like the previous example:. Fields and keys A field is some part of a record. For example, a file containing records describing your grocery list might have two fields, one for the item, and another for the quantity needed:. A field separator is some character you put between fields in a record.

In the above example, spaces are used as field separators. If you don't specify otherwise, the sort utility assumes that space is the field separator. A different grocery list might use, for example, comma as a field separator. This would allow you to have blanks within a field:. A sort key is the field or fields used in ordering records. For example, here is a file describing mineral specimens. Each record has three fields--the type of mineral, the price, and the place it was collected.

To sort this file by place the third field , we use:. Sometimes you want to sort a file on more than one key. For example, suppose you want to sort a list of students by grade and name: you want all the A's together, and all the B's, but within each grade you want the students in alphabetical order. The most important key is called the major key.

If two records have the same value in their major key field, sort can then use another field sometimes called the minor key as a tie-breaker. You can have any number of keys. For example, if you specify seven sort keys, and two given records have identical values for the first six keys, but different values for the seventh key, those two records will be ordered according to their seventh key. For example, suppose you have a file named x of records with ten keys each, and you want to sort on the third, fourth, fifth, ninth, and first fields, in that order.

Here is the correct command:. Sort options Here is the full syntax of the sort command, taken from the man page:. This command syntax is typical of Unix utilities: there are a group of letters -mcubfdinrt that must be preceded by a hyphen. These "dash options" change the way that files are sorted. The -m option selects merging instead of sorting. Merging produces a single sorted file by putting together two or more files that are already sorted by the same criteria.

More than one infile must be specified. If the input files are not already sorted, sort will not produce sorted output, and it won't warn you either. The -c option causes the input to be checked to see if it is sorted; it won't actually sort anything. If the input file is correctly sorted according to the selected keys, there will be no output. The man page doesn't say what will be output in case sort errors are found.

The -u option stands for unique. With this option, whenever two records compare equal in all keys not necessarily in other fields , sort will throw away one of them. The output of sort -u will thus contain only one of each set of key values. The -b option instructs sort to ignore leading blanks while sorting. Compare these examples:. The -f option stands for "fold," which means that uppercase letters should be treated the same as lowercase.

The -d option selects "dictionary"-style comparisons. Punctuation marks actually, anything but letters, digits and blanks are ignored:.


  • Shattered Destiny (New Beginnings Book 5).
  • Inside The 1960s Civil Rights War - A Black-Americans Personal Story.
  • Peripheral Links.
  • Bobby Sands - An Irish martyr??
  • Zen Anti-Diet: Mindful Eating for Health, Vitality and Weight Loss.

The -n option specifies that a sort key is a number, and should be sorted by its numeric value, not its string value. Compare these two examples:. The -r option reverses the sort order from ascending to descending:. Finally, the -t option allows you to specify a field separator. The t stands for "tab character," another name for the field separator character, but this is confusing because there is an ASCII character called tab, which may or may not be used as a field separator.

Linux Certif

The t must be followed immediately by the character to be used as field separator:. If you use a field separator that has some special meaning to the shell, you should enclose it in apostrophes:. The -T option may be necessary if you are sorting large files; it tells sort to use a specified directory for its scratch area while sorting. The -T must be followed by one space, then the pathname of a directory. For example, I was sorting a 5-megabyte file once and sort bombed out due to lack of space.

Key offsets It is possible to use part of a field as a sort key. You may specify that the nth character of a field be the beginning or end of a sort key. In this syntax, the a and b numbers give the offsets into the fields where the key begins, that is, it specifies the number of characters into the field. For example, let us suppose that the first field on a line has the form aannnn, where the aa portion is a letter code and the nnnn portion is a string of digits. If you want to sort on the digit portion, ignoring the letters, use:. Here is an example of a key offset.

You are given a file containing people's Social Security Numbers of the form aaabbcccc, and you want to sort on the bb section as the major key, and the aaa and cccc sections as minor keys. Colon : is used as the field separator. This command pipeline sorts the output of the " ps -ef " command.

Because no arguments are supplied to the sort command, the output is sorted in alphabetic order by the first column of the ps -ef output i. This command performs a numeric sort on the fifth column of the " ls -al " output. This results in a file listing where the files are listed in ascending order, from smallest in size to largest in size.

The same command as the previous, except the output is piped into the more command. This is useful when the output will not all fit on one screen. This command reverses the order of the numeric sort, so files are listed in descending order of size, with the largest file listed first, and the smallest file listed last. The output of du has been very informative, but it's difficult to scan a listing to ascertain the four or five largest directories, particularly as more and more directories and files are included in the output.

The good news is that the Unix sort utility is just the tool we need to sidestep this problem. This is useful with shells that don't support process substitution. For example, to diff two files after sorting them, you might do:. See article The namesort program sorts a list of names by the last name. See also namesort. The namesort. For example, suppose we want to list the distinct file owners in a directory. To do this, we must perform three discrete tasks:. If you are short of memory sort may be swapping stuff out to disk and hence your performance problems.

FreeBSD Manual Pages

This is much better than sorts that simply assume that virtual memory is endless and cause the OS to thrash madly but is much slower than doing the whole thing in memory. In a nutshell, interest rate swap can be said to be a contractual agreement between two parties to exchange interest payments. The most common type of interest rate swap arrangement is one in which Party A agrees to make payments to Party B based on fixed interest rate, and Party B agrees to pay party A based on floating interest rate. In almost all cases the floating rate is tied to some kind of reference rate. LIBOR stands for London interbank offered rate and is one of the most used reference rates in case of floating securities.

Recommended Posts:

The payment for Mr. Now assume there is another guy Mr. The payment received by him never changes as the interest rate assumed in the transaction if fixed in nature. Now Mr. This is when both of them enter into an interest rate swap contract. The terms of the contract state that Mr.

X agrees to pay Mr. In lieu of this payment, Mr. Y agrees to pay Mr. Now, under the swap agreement, Mr. Y, and Mr. The two transactions partially offset each other, the net transaction would lead Mr. So, what did the interest rate swap did to Mr. X and Mr. The swap has allowed Mr. Either way, he will have the fixed monthly return of 1. It is very important to understand that under the interest rate swap arrangement, parties entering into the contract never exchange the principal amount. The principal amount is just notional here. There are many uses to which the interest rate swaps are put and we will discuss each one of them later in the article.

Qt Linguist Manual: Release Manager | Qt

Interest rate swaps are traded over the counter and generally, the two parties need to agree on two issues when going into the interest rate swap agreement. The length of a swap will decide the start and termination date of the contract while terms of the swap will decide the fixed rate on which the swap will work. A swap rate is the rate of the fixed leg of the swap as determined in the free market. So, the rate which is quoted by various banks for this instrument is known as swap rate. So, the swap rate is the fixed interest rate that the receiver demands in exchange for uncertainty which existed because of the floating leg of the transaction.

The plot of swap rates across all the available maturities is known as the swap curve. It is very similar to the yield curve of any country where the prevailing interest rate across the tenure are plotted on a graph. Since swap rate is a good gauge of the interest rate perception, market liquidity, bank credit movement, the swap curve in isolation become very important for interest rate benchmark. Generally, the sovereign yield curve and swap curve are of similar shape.

Options Trading Basics EXPLAINED (For Beginners)

However, at times there is a difference between the two. Historically this difference tended to be positive, which reflected higher credit risk with the banks compared to a sovereign. However, considering other factors which are indicative of supply-demand, liquidity, the U. Please refer to the graph below for better understanding.