Hello,
I am in need of removing duplicate lines from within a file per section.
File:
I need to remove duplicates from each section. Each section starts with ABC1 and all duplicates within that section need to be pushed into another file.
From my research within the forum, I have been working with the following command:
awk '/ABC1/ ( ABC1 = $2 ) !x[ABC1,$0]++' File
However, I must be doing something wrong because it is not removing the duplicates. What am I doing wrong or is there a better way?
I am currently using Bourne Shell (/bin/sh)
Thank you!
Last edited by Scott; 01-11-2010 at 05:30 PM..
Reason: Removed fonts and sizes, added code tags
Hi,
I am trying to remove duplicate lines from a file. For example the contents of example.txt is:
this is a test
2342
this is a test
34343
this is a test
43434
and i want to remove the "this is a test" lines only and end up with the numbers in the file, that is, end up with:
2342... (4 Replies)
Hi,
I need to concatenate three files in to one destination file.In this if some duplicate data occurs it should be deleted.
eg:
file1:
-----
data1 value1
data2 value2
data3 value3
file2:
-----
data1 value1
data4 value4
data5 value5
file3:
-----
data1 value1
data4 value4 (3 Replies)
Hello,
I need help in putting duplicate lines within a section into another file. Here is what I'm struggling with:
Using this file data.txt:
ABC1 012345 header
ABC2 7890-000
ABC3 012345 Header Table
ABC4
ABC5 593.0000 587.4800
ABC5 593.5000 587.6580 <= dup need to remove
ABC5... (4 Replies)
So I have two files. The first file, file1.txt, has lines of numbers separated by commas.
file1.txt
10,2,30,50
22,6,3,15,16,100
73,55
78,40,33,30,11
73,55
99,82,85
22,6,3,15,16,100
The second file, file2.txt, has sentences.
file2.txt
"the cat is fat"
"I like eggs"
"fish live in... (6 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
You will write a script that will remove all HTML tags from an HTML document and remove any consecutive... (3 Replies)
Discussion started by: tburns517
3 Replies
LEARN ABOUT BSD
syserrlst
SYSERRLST(5) File Formats Manual SYSERRLST(5)NAME
syserrlst - error message file format
DESCRIPTION mkerrlst(1), creates error message files in the format described below.
An ``error message file'' consists of a header, an array of structures specifying the offset and length of each message, and the array of
message strings separated by newlines.
The message strings are separated by newlines but the newline characters are not included in the size of the message. These newline char-
acters serve only to make the file editable or printable (after stripping off the header).
The file format is:
/*
* Definitions used by the 'mkerrlst' program which creates error message
* files.
*
* The format of the file created is:
*
* struct ERRLSTHDR ehdr;
* struct ERRLST emsg[num_of_messages];
* struct {
* char msg[] = "error message string";
* char lf = '0;
* } [num_of_messages];
*
* Note: the newlines are NOT included in the message lengths, the newlines
* are present to make it easy to 'cat' or 'vi' the file.
*/
struct ERRLSTHDR
{
short magic;
short maxmsgnum;
short maxmsglen;
short pad[5]; /* Reserved */
};
struct ERRLST
{
off_t offmsg;
short lenmsg;
};
#define ERRMAGIC 012345
SEE ALSO mkerrlst(1), syserrlst(3)BUGS
Format of the file isn't necessarily portable between machines.
HISTORY
This file format is new with 2.11BSD.
3rd Berkeley Distribution March 7, 1996 SYSERRLST(5)