Sponsored Content
Top Forums Shell Programming and Scripting Remove duplicate lines from a file Post 302882504 by bartus11 on Tuesday 7th of January 2014 11:37:26 AM
Old 01-07-2014
Try replacing "awk" with "nawk".
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove Duplicate Lines in File

I am doing KSH script to remove duplicate lines in a file. Let say the file has format below. FileA 1253-6856 3101-4011 1827-1356 1822-1157 1822-1157 1000-1410 1000-1410 1822-1231 1822-1231 3101-4011 1822-1157 1822-1231 and I want to simply it with no duplicate line as file... (5 Replies)
Discussion started by: Teh Tiack Ein
5 Replies

2. UNIX for Dummies Questions & Answers

Remove Duplicate lines from File

I have a log file "logreport" that contains several lines as seen below: 04:20:00 /usr/lib/snmp/snmpdx: Agent snmpd appeared dead but responded to ping 06:38:08 /usr/lib/snmp/snmpdx: Agent snmpd appeared dead but responded to ping 07:11:05 /usr/lib/snmp/snmpdx: Agent snmpd appeared dead but... (18 Replies)
Discussion started by: Nysif Steve
18 Replies

3. Shell Programming and Scripting

Command/Script to remove duplicate lines from the file?

Hello, Can anyone tell Command/Script to remove duplicate lines from the file? (2 Replies)
Discussion started by: Rahulpict
2 Replies

4. UNIX for Dummies Questions & Answers

How to delete or remove duplicate lines in a file

Hi please help me how to remove duplicate lines in any file. I have a file having huge number of lines. i want to remove selected lines in it. And also if there exists duplicate lines, I want to delete the rest & just keep one of them. Please help me with any unix commands or even fortran... (7 Replies)
Discussion started by: reva
7 Replies

5. Shell Programming and Scripting

remove duplicate lines from file linux/sh

greetings, i'm hoping there is a way to cat a file, remove duplicate lines and send that output to a new file. the file will always vary but be something similar to this: please keep in mind that the above could be eight occurrences of each hostname or it might simply have another four of an... (2 Replies)
Discussion started by: crimso
2 Replies

6. Shell Programming and Scripting

Remove duplicate lines from first file comparing second file

Hi, I have two files with below data:: file1:- 123|aaa|ppp 445|fff|yyy 999|ttt|jjj 555|hhh|hhh file2:- 445|fff|yyy 555|hhh|hhh The records present in file1, not present in file 2 should be writtent to the out put file. output:- 123|aaa|ppp 999|ttt|jjj Is there any one line... (3 Replies)
Discussion started by: gani_85
3 Replies

7. Shell Programming and Scripting

How do I remove the duplicate lines in this file?

Hey guys, need some help to fix this script. I am trying to remove all the duplicate lines in this file. I wrote the following script, but does not work. What is the problem? The output file should only contain five lines: Later! (5 Replies)
Discussion started by: Ernst
5 Replies

8. Shell Programming and Scripting

Remove duplicate lines from a 50 MB file size

hi, Please help me to write a command to delete duplicate lines from a file. And the size of file is 50 MB. How to remove duplicate lins from such a big file. (6 Replies)
Discussion started by: vsachan
6 Replies

9. Shell Programming and Scripting

Remove duplicate lines from file based on fields

Dear community, I have to remove duplicate lines from a file contains a very big ammount of rows (milions?) based on 1st and 3rd columns The data are like this: Region 23/11/2014 09:11:36 41752 Medio 23/11/2014 03:11:38 4132 Info 23/11/2014 05:11:09 4323... (2 Replies)
Discussion started by: Lord Spectre
2 Replies

10. Shell Programming and Scripting

Remove duplicate lines, sort it and save it as file itself

Hi, all I have a csv file that I would like to remove duplicate lines based on 1st field and sort them by the 1st field. If there are more than 1 line which is same on the 1st field, I want to keep the first line of them and remove the rest. I think I have to use uniq or something, but I still... (8 Replies)
Discussion started by: refrain
8 Replies
REFORMAIL(1)						      Double Precision, Inc.						      REFORMAIL(1)

NAME
reformail - E-mail reformatting tool SYNOPSIS
reformail -s command [option...] reformail -D len filename reformail -x header:... reformail -X header:... reformail [options...] See below for additional options DESCRIPTION
The reformail program reads a message on standard input, reformats it in some way, and writes the message to standard output: Splitting mailboxes into individual messages The -s option splits the mbox-formatted mailbox file on standard input into individual messages. An external program is executed for each message. The contents of each individual message will be provided to the external program on standard input. If the FILENO environment variable is set to a number, reformail will consecutively increment FILENO each time the program is executed for each individual message. If FILENO is not set, it's initial value will be "000". If FILENO is set to a non-numeric value, FILENO will remain unchanged. Detecting duplicate messages The -D option implements a simple way to delete duplicate messages in incoming mail. filename is a file that will be approximately 'len' bytes long. This file will be used by reformail to save message IDs seen in recent mail. reformail reads the message on standard input. If the message has a Message-ID: header that's already in the cache file, reformail terminates with the exit code set to 0. Otherwise, reformail terminates with the exit code set to 1. Extracting headers The -x and -X options extract the indicated headers from the message, and print them to standard output. Multiple -x and -X options can be specified at the same time, and may be intermixed. The -x option extracts and prints the contents of the header. The -X option prints the name of the header as well. In all other situations, reformail copies the message on its standard input to its standard output, reformatting the message as follows: OPTIONS
-a'header: value' Append a custom header to the message if this header does not already exist. If the header is either Message-ID: or Resent-Message-ID: and the value is empty, reformail generates a (hopefully) unique message ID for you. -A'header: value' Append a custom header to the message even if this header already exists. If the header is either Message-ID: or Resent-Message-ID: and the value is empty, reformail generates a (hopefully) unique message ID for you. -c Concatenate multi-line headers. Headers split on multiple lines are combined into a single line. -dn If n is 1, each line will be terminated with CRLF. If n is 0 (default), each line will be terminated with LF. reformail reads a message with either line terminator, and will force the message to have the specified line termination. -f0 Remove the "From_" line from the message, if it's there. -f1 Add the "From_" line to the message, if it's not there. reformail will attempt to generate the "From_" line from any Errors-To:, Return-Path:, or From: headers in the message. "root" will be used if reformail is unable to determine the return address. -i'header: value' Appends a custom header to the message. If this header already exists it is renamed by prepending "Old-" to the name of the header. -I'header: value' Append a custom header to the message. If this header already exists in the message, the old header is completely removed. If the value is empty, any existing header is completely removed, and nothing gets appended. -R oldheader: newheader: Rename the indicated header. -u'header:' If this header occurs multiple times in the message, remove all occurrences except the first one. -U'header:' If this header occurs multiple times in the message, remove all occurrences except the last one. AUTOREPLIES
The autoreply options from earlier versions of mailbot have been moved into mailbot(1)[1]. BUGS
For the -a, -A, and -I options, a space after the header name and the colon is considered to be a non-empty field. Do not provide the same header to more than one family of header-modifying options, such as -u/-U and -a/-A. Doing so yields unpredictable results. It's better to run reformail several times (use a pipe, perhaps). SEE ALSO
courier(8)[2], sendmail(8), mailbot(1)[1], maildrop(1)[3]. AUTHOR
Sam Varshavchik Author NOTES
1. mailbot(1) [set $man.base.url.for.relative.links]/mailbot.html 2. courier(8) [set $man.base.url.for.relative.links]/courier.html 3. maildrop(1) [set $man.base.url.for.relative.links]/maildrop.html Courier Mail Server 08/30/2011 REFORMAIL(1)
All times are GMT -4. The time now is 11:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy