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 REDHAT
encode::mime::header
Encode::MIME::Header(3pm) Perl Programmers Reference Guide Encode::MIME::Header(3pm)NAME
Encode::MIME::Header -- MIME 'B' and 'Q' header encoding
SYNOPSIS
use Encode qw/encode decode/;
$utf8 = decode('MIME-Header', $header);
$header = encode('MIME-Header', $utf8);
ABSTRACT
This module implements RFC 2047 Mime Header Encoding. There are 3 variant encoding names; "MIME-Header", "MIME-B" and "MIME-Q". The dif-
ference is described below
decode() encode()
----------------------------------------------
MIME-Header Both B and Q =?UTF-8?B?....?=
MIME-B B only; Q croaks =?UTF-8?B?....?=
MIME-Q Q only; B croaks =?UTF-8?Q?....?=
DESCRIPTION
When you decode(=?encoding?X?ENCODED WORD?=), ENCODED WORD is extracted and decoded for X encoding (B for Base64, Q for Quoted-Printable).
Then the decoded chunk is fed to decode(encoding). So long as encoding is supported by Encode, any source encoding is fine.
When you encode, it just encodes UTF-8 string with X encoding then quoted with =?UTF-8?X?....?= . The parts that RFC 2047 forbids to
encode are left as is and long lines are folded within 76 bytes per line.
BUGS
It would be nice to support encoding to non-UTF8, such as =?ISO-2022-JP? and =?ISO-8859-1?= but that makes the implementation too compli-
cated. These days major mail agents all support =?UTF-8? so I think it is just good enough.
SEE ALSO
Encode
RFC 2047, <http://www.faqs.org/rfcs/rfc2047.html> and many other locations.
perl v5.8.0 2002-06-01 Encode::MIME::Header(3pm)