Sponsored Content
Top Forums Shell Programming and Scripting Remove duplicate value based on two field $4 and $5 Post 302771685 by Jotne on Thursday 21st of February 2013 08:31:57 AM
Old 02-21-2013
I seems that this is nearly the same as you have here:
https://www.unix.com/shell-programmin...ue-file-2.html
I may be that your request is difficult to understand, or you does not explain it good enough, since you does not get answer.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to get remove duplicate of a file based on many conditions

Hii Friends.. I have a huge set of data stored in a file.Which is as shown below a.dat: RAO 1869 12 19 0 0 0.00 17.9000 82.3000 10.0 0 0.00 0 3.70 0.00 0.00 0 0.00 3.70 4 NULL LEE 1870 4 11 1 0 0.00 30.0000 99.0000 0.0 0 0.00 0 0.00 0.00 0.00 0 ... (3 Replies)
Discussion started by: reva
3 Replies

2. Shell Programming and Scripting

Remove duplicate lines (the first matching line by field criteria)

Hello to all, I have this file 2002 1 23 0 0 2435.60 131.70 5.60 20.99 0.89 0.00 285.80 2303.90 2002 1 23 15 0 2436.60 132.90 6.45 21.19 1.03 0.00 285.80 2303.70 2002 1 23 ... (6 Replies)
Discussion started by: joggdial3000
6 Replies

3. Shell Programming and Scripting

Remove lines with duplicate first field

Trying to cut down the size of some log files. Now that I write this out it looks more dificult than i thought it would be. Need a bash script or command that goes sequentially through all lines of a file, and does this: if field1 (space separated) is the number 2012 print the entire line. Do... (7 Replies)
Discussion started by: ajp7701
7 Replies

4. Shell Programming and Scripting

Remove duplicate lines based on field and sort

I have a csv file that I would like to remove duplicate lines based on field 1 and sort. I don't care about any of the other fields but I still wanna keep there data intact. I was thinking I could do something like this but I have no idea how to print the full line with this. Please show any method... (8 Replies)
Discussion started by: cokedude
8 Replies

5. Shell Programming and Scripting

Remove duplicate based on Group

Hi, How can I remove duplicates from a file based on group on other column? for example: Test1|Test2|Test3|Test4|Test5 Test1|Test6|Test7|Test8|Test5 Test1|Test9|Test10|Test11|Test12 Test1|Test13|Test14|Test15|Test16 Test17|Test18|Test19|Test20|Test21 Test17|Test22|Test23|Test24|Test5 ... (2 Replies)
Discussion started by: yale_work
2 Replies

6. Shell Programming and Scripting

How To Remove Duplicate Based on the Value?

Hi , Some time i got duplicated value in my files , bundle_identifier= B Sometext=ABC bundle_identifier= A bundle_unit=500 Sometext123=ABCD bundle_unit=400 i need to check if there is a duplicated values or not if yes , i need to check if the value is A or B when Bundle_Identified ,... (2 Replies)
Discussion started by: OTNA
2 Replies

7. Shell Programming and Scripting

Remove duplicate entries based on the range

I have file like this: chr start end chr15 99874874 99875874 chr15 99875173 99876173 aa1 chr15 99874923 99875923 chr15 99875173 99876173 aa1 chr15 99874962 99875962 chr15 99875173 99876173 aa1 chr1 ... (7 Replies)
Discussion started by: raj_k
7 Replies

8. Shell Programming and Scripting

Remove duplicate rows based on one column

Dear members, I need to filter a file based on the 8th column (that is id), and does not mather the other columns, because I want just one id (1 line of each id) and remove the duplicates lines based on this id (8th column), and does not matter wich duplicate will be removed. example of my file... (3 Replies)
Discussion started by: clarissab
3 Replies

9. Shell Programming and Scripting

Remove sections based on duplicate first line

Hi, I have a file with many sections in it. Each section is separated by a blank line. The first line of each section would determine if the section is duplicate or not. if the section is duplicate then remove the entire section from the file. below is the example of input and output.... (5 Replies)
Discussion started by: ahmedwaseem2000
5 Replies

10. UNIX for Dummies Questions & Answers

Using awk to remove duplicate line if field is empty

Hi all, I've got a file that has 12 fields. I've merged 2 files and there will be some duplicates in the following: FILE: 1. ABC, 12345, TEST1, BILLING, GV, 20/10/2012, C, 8, 100, AA, TT, 100 2. ABC, 12345, TEST1, BILLING, GV, 20/10/2012, C, 8, 100, AA, TT, (EMPTY) 3. CDC, 54321, TEST3,... (4 Replies)
Discussion started by: tugar
4 Replies
strfmon(3C)															       strfmon(3C)

NAME
strfmon - convert monetary value to string SYNOPSIS
Remarks The ANSI C "" construct denotes a variable length argument list whose optional [or required] members are given in the associated comment DESCRIPTION
The function places characters into the array pointed to by s as controlled by the string pointed to by format. No more than maxsize bytes are placed into the array. The format is a character string that contains two types of objects: plain characters, which are simply copied to the output, and conver- sion specifications, each of which results in the fetching of zero or more arguments that are converted and formatted. The arguments are of type see the section for details. The results are undefined if there are insufficient arguments for the format. If the format is exhausted while arguments remain, the excess arguments are ignored. A conversion specification is the string flag]...[field_width][right_precision] conversion_character Each element of the sequence is specified as follows: Flags One or more of the following optional flags can be specified to control the conversion: An (equal sign) followed by a single character f which is used as the numeric fill character. The fill character must be repre- sentable in a single byte in order to work with precision and width counts. The default numeric fill character is the space character. This flag does not affect field width filling which always uses the space character. This flag is ignored unless a left precision (see below) is specified. Do not format the currency amount with grouping characters. The default is to insert the grouping characters if defined for the current locale. Specify the style for representing positive and negative currency amounts. Only one of or (plus sign or left parenthesis) may be specified. If is specified, the locale's equivalent of + and - are used (for example, in the locale: an empty string if positive and - if negative). If is specified, negative amounts are enclosed within parentheses. If neither flag is specified, the style is used. Suppress the currency symbol from the output conversion. A minus sign specifying the alignment. If this flag is present all fields are left-justified (padded to the right) rather than right-justified. Field Width w A decimal digit string w specifying a minimum field width in bytes in which the result of the conversion is right-justified (or left-justified if the flag - is specified). The default is zero. Left Precision A followed by a decimal digit string n specifying a maximum number of digits expected to be formatted to the left of the radix character. This option can be used to keep the formatted output from multiple calls to the aligned in the same columns. It can also be used to fill unused positions with a special character as in $***123.45. This option causes an amount to be formatted as if it has the number of digits specified by n. If more than n digit positions are required, this conversion specification is ignored. Digit positions in excess of those actually required are filled with numeric fill character (see the flag above). If grouping has not been suppressed with the flag, and it is defined for the current locale, grouping separators are inserted before the fill characters (if any) are added. Grouping separators are not applied to fill characters even if the fill character is a digit. To ensure alignment, any characters appearing before or after the number in the formatted output such as currency or sign symbols are padded as necessary with space characters to make their positive and negative formats an equal length. Right Precision A period followed by a decimal digit string p specifying the number of digits after the radix character If the value of the right precision p is zero, no radix character appears If a right precision is not included, a default specified by the current locale is used The amount being formatted is rounded to the specified number of digits prior to formatting. Conversion Characters The conversion characters and their meanings are: The argument is formatted according to the locale's international currency format (for example, in the locale: The argument is formatted according to the locale's national currency format (for example, in the locale: Convert to a no argument is converted. The entire conversion specification must be %%. Notes The behavior of the function in a UNIX 2003 conforming application differs from its behavior in a non-conforming application. With the conversion character the function uses the fourth character of the string defined in of the current locale instead of a space as a separa- tor for separating different items in a monetary quantity as dictated by the values of and Only the first three characters will be taken as the currency symbol. As a result, the formatting of internationally formatted monetary quantities may change. EXTERNAL INFLUENCES
Locale The category of the program's locale affects the behavior of this function including the monetary radix character (which may be different from the numeric radix character affected by the category), the grouping separator, the currency symbols and formats. RETURN VALUE
If the total number of resulting bytes including the terminating null byte is not more than maxsize, the function returns the number of bytes placed into the array pointed to by s, not including the terminating null byte Otherwise, -1 is returned, the contents of the array are indeterminate, and errno is set to indicate the error. ERRORS
The function will fail if: Conversion stopped due to lack of space in the buffer. EXAMPLES
The following program segment formats the monetary value using the locale with a left precision of and as the fill character. char string[31]; double amt = -4321.123; setlocale(LC_MONETARY, "en_US.roman8"); strfmon(string, 31, "The amount is %=*#5n.", amt); The string array will contain: The amount is -$*4,321.12. As an other example, given the locale of and the values and --------------------------------------------------------------------------- Conversion Output Comments Specification --------------------------------------------------------------------------- %n $123.45 default formatting -$123.45 $3,456.78 --------------------------------------------------------------------------- %11n $123.45 right align within an 11 character field -$123.45 $3,456.78 --------------------------------------------------------------------------- %#5n $ 123.45 align columns for values up to 99,999 -$ 123.45 $ 3,456.78 --------------------------------------------------------------------------- %=*#5n $***123.45 specify a fill character -$***123.45 $*3,456.78 --------------------------------------------------------------------------- %=0#5n $000123.45 fill characters do not use grouping -$000123.45 even if the fill character is a digit $03,456.78 --------------------------------------------------------------------------- %^#5n $ 123.45 disable the grouping separator -$ 123.45 $ 3456.78 --------------------------------------------------------------------------- %^#5.0n $ 123 round off to whole units -$ 123 $ 3457 --------------------------------------------------------------------------- %^#5.4n $ 123.4500 increase the precision -$ 123.4500 $ 3456.7810 --------------------------------------------------------------------------- %(#5n $ 123.45 use an alternative positive/negative style ($ 123.45) $ 3,456.78 --------------------------------------------------------------------------- %!(#5n 123.45 disable the currency symbol ( 123.45) 3,456.78 --------------------------------------------------------------------------- AUTHOR
was developed by HP. SEE ALSO
localeconv(3C), thread_safety(5). STANDARDS CONFORMANCE
strfmon(3C)
All times are GMT -4. The time now is 01:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy