A script that removes dubblets lines into a TXT file?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
if you put the following code in a separate file, call it "doubleFilter.pl" it will filter the file given in
$in to the file in $out. You should set 2 different files. If you want to overwrite the first file comment out the last line (remove the "#"). The new file will be free of direct double lines. (Is that what you wanted?)
#!/usr/bin/perl
$in="/home/me/perl/test.txt";
$out="/home/me/perl/test2.txt";
open(IN,"$in");
open(OUT,"> $out");
while(<IN>){
print OUT if ($_ ne $old);
$old = $_;
}
close(IN);
close(OUT);
#system("mv $out $in");
'apropos <searchterm>' (aka 'man -k <searchterm>') is a good way to search for useful commands. It will list all man pages related to the term you use.
'apropos <searchterm>' (aka 'man -k <searchterm>') is a good way to search for useful commands. It will list all man pages related to the term you use.
And don't forget google.
Is there a databank/database for finding useful Bash/sh script?
like for video, mp3, ascii, txt, ... it does exists for visual basic, so why not for linux?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.