Hi Monks, who are always smarter than me. I'm trying to use the following code but rather than modify just one file to contain only unique lines I'm trying to modify many files in a directory.
I've successfully erased my data 5 times with some not so successful modifications so far so I'm seeking some wisdom. Here's the first bit of code:
#!/usr/bin/perl –w open(INF,"db.txt"); @data = <INF>; close(INF); @sd = sort(@data); for(@sd){ push @out, $_ if (not @out) or ($out[-1] ne $_); }; open(OUTF,">outdb.txt"); print OUTF; close(OUTF);
I'm pretty sure I'm overthinking it and the solution is very, very simple. Here's my code to find the files. See below. I just can't seem to get the two bits of code together properly.
#find the files I want to change my @files; find( sub { return unless -f; # Files only return unless /\.txt$/; # Name must end in ".txt" push @files, $File::Find::name; }, $directory );
In reply to parse multiple text files keep unique lines only by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |