10-25-2011
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.
Quote:
J'aime lire ce livre
Cet ouvrage me donne de la joie a le lire
Le ciel est tres bleu ce matin
J'aime lire ce livre
Cet ordinateur est trop lent pour moi
J'aime lire ce livre
J'aime ce site
J'aime ce site
J'aime lire ce livre
Le ciel est tres bleu ce matin
Cet ordinateur est trop lent pour moi
J'aime lire ce livre
Cet ouvrage me donne de la joie a le lire
Le ciel est tres bleu ce matin
J'aime lire ce livre
Cet ordinateur est trop lent pour moi
J'aime lire ce livre
J'aime ce site
J'aime ce site
J'aime lire ce livre
Le ciel est tres bleu ce matin
Cet ordinateur est trop lent pour moi
J'aime lire ce livre
Cet ouvrage me donne de la joie a le lire
Le ciel est tres bleu ce matin
J'aime lire ce livre
Cet ordinateur est trop lent pour moi
J'aime lire ce livre
J'aime ce site
J'aime ce site
J'aime lire ce livre
Le ciel est tres bleu ce matin
Cet ordinateur est trop lent pour moi
J'aime lire ce livre
Cet ouvrage me donne de la joie a le lire
Le ciel est tres bleu ce matin
J'aime lire ce livre
Cet ordinateur est trop lent pour moi
J'aime lire ce livre
J'aime ce site
J'aime ce site
J'aime lire ce livre
Le ciel est tres bleu ce matin
Cet ordinateur est trop lent pour moi
J'aime lire ce livre
Le ciel est tres bleu ce matin
Cet ordinateur est trop lent pour moi
J'aime lire ce livre
J'aime ce site
J'aime ce site
J'aime lire ce livre
Cet ordinateur est trop lent pour moi
J'aime lire ce livre
J'aime ce site
J'aime ce site
J'aime lire ce livre
Le ciel est tres bleu ce matin
Cet ordinateur est trop lent pour moi
J'aime lire ce livre
Le ciel est tres bleu ce matin
Cet ordinateur est trop lent pour moi
J'aime lire ce livre
J'aime ce site
J'aime ce site
J'aime lire ce livre
Cet ordinateur est trop lent pour moi
J'aime lire ce livre
J'aime ce site
J'aime ce site
J'aime lire ce livre
Le ciel est tres bleu ce matin
Cet ordinateur est trop lent pour moi
J'aime lire ce livre
Le ciel est tres bleu ce matin
Cet ordinateur est trop lent pour moi
J'aime lire ce livre
J'aime ce site
J'aime ce site
I wrote the following script, but does not work. What is the problem?
Quote:
#!/usr/bin/ksh
cat file | while read line
do
sort file > file1
done
while read line
do
if $line!=$line++
then
echo $line
else
rm $line
fi
done<file1
mv file1 file.xls
The output file should only contain five lines:
Quote:
J'aime lire ce livre
Cet ouvrage me donne de la joie a le lire
Le ciel est tres bleu ce matin
J'aime ce site
Cet ordinateur est trop lent pour moi.
Later!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
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
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
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
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
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
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
8. Shell Programming and Scripting
Hi,
I have a csv file which contains some millions of lines in it.
The first line(Header) repeats at every 50000th line. I want to remove all the duplicate headers from the second occurance(should not remove the first line).
I don't want to use any pattern from the Header as I have some... (7 Replies)
Discussion started by: sudhakar T
7 Replies
9. Shell Programming and Scripting
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
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
LEARN ABOUT DEBIAN
lire::xmlspeccontainer
XMLSpecContainer(3pm) LogReport's Lire Documentation XMLSpecContainer(3pm)
NAME
Lire::XMLSpecContainer - Base clase for XML report and filter specifications
SYNOPSIS
use base qw/Lire::XMLSpecContainer/;
DESCRIPTION
This is the base class for Lire::ReportSpec and Lire::FilterSpec which are XML specifications used to compute reports. This man page
document the attributes common to both type of specification.
id( [ $new_id ] )
Returns the type id of this specification. It $new_id is set, it will change the id of the specification.
superservice( [ $new_superservice ] )
Returns the superservice (aka base DLF schema) used by this specification. It $new_superservice is set, it will change the superservice of
the specification.
schema( [ $new_schema ] )
Returns the Lire::DLfSchema object used by this specification. This can be the superservice or any of its Lire::ExtendedSchema or
Lire::DerivedSchema.
If $new_schema is a string, the specification's schema will be changed to that schema. If $new_schema is undef, the base DlfSchema (aka
superservice) will be used.
joined_schemas( [ $new_schemas ] )
Returns as an array reference, the list of schemas that are joined in this specification.
If $new_schemas is set, the list of joined schemas will be changed to that list. This is an array reference of schema name. All of these
schemas should be join compatible with the schema specified in the schema() attribute.
schemas()
Returns in an array reference all the schemas used by this specification. This will include the base schema as well as any joined schemas.
has_field( $name )
Returns whether the field named $name is available in this specification's schema or any of its joined schema.
field( $name )
Returns the Lire::Field object named $name present in one of the specification's joined schema.
title( [ $new_title ]
This method returns the title of this specification. If $new_title is set, the specification's title will be changed to that value.
The returned value is localized if a translation string is available. The domain used for translation is 'lire-<superservice'.
description( [ $new_description ]
This method returns the description of this specification. If $new_description is set, the specification's description will be changed to
that value. That description is a DocBook string describing the specification's purpose.
The returned value is localized if a translation string is available. The domain used for translation is 'lire-<superservice'.
display_title( [ $new_title ]
This method returns the title that will be displayed in the generated specification. This value can contains reference to the
specification's parameters using the '$name' syntax.
If $new_title is set, the specification's display title will be changed to that value.
The returned value is localized if a translation string is available. The domain used for translation is 'lire-<superservice'.
display_description( [ $new_description ]
This method returns the description that will be displayed in the generated report. This value can contains reference to the
specification's parameters using the '$name' syntax.
If $new_description is set, the specification's description will be changed to that value. That description is a DocBook string describing
the specification's purpose.
The returned value is localized if a translation string is available. The domain used for translation is 'lire-<superservice'.
expanded_display_title()
Returns display_title() with parameters reference expanded.
expanded_display_description()
Returns display_description() with parameters reference expanded.
print( $fh )
Prints this specification as XML on $fh.
SEE ALSO
Lire::ReportSpec(3pm), Lire::FilterSpec(3pm), Lire::XMLSpecParser(3pm)
AUTHORS
Francis J. Lacoste <flacoste@logreport.org>
Wolfgang Sourdeau <wolfgang@logreport.org>
VERSION
$Id: XMLSpecContainer.pm,v 1.41 2006/07/23 13:16:30 vanbaal Exp $
COPYRIGHT
Copyright (C) 2001-2004 Stichting LogReport Foundation LogReport@LogReport.org
This file is part of Lire.
Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with
http://www.gnu.org/copyleft/gpl.html.
Lire 2.1.1 2006-07-23 XMLSpecContainer(3pm)