hseong3
Newbie level 1
I have a text (list.txt) to process which looks like this:
.\hlee4\unix
.\hlee4\perl
file1.pl
file2.pl
file3.pl
.\hlee4\linux
file_a.txt
file_b.txt
.\hlee4\C++
.\hlee4\Verilog
file_x.v
file_y.v
The text file consists of the names of directories and the files in each directories. If the directory is empty, no files will be listed under it.
I have been trying to write a Perl script to remove the names of directories which has no files in it. I really have no idea how to do this.
The processed text should look like this:
.\hlee4\perl
file1.pl
file2.pl
file3.pl
.\hlee4\linux
file_a.txt
file_b.txt
.\hlee4\Verilog
file_x.v
file_y.v
with .\hlee4\unix and .\hlee4\C++ removed.
I have been looking at this for a few days now. HELP !!
.\hlee4\unix
.\hlee4\perl
file1.pl
file2.pl
file3.pl
.\hlee4\linux
file_a.txt
file_b.txt
.\hlee4\C++
.\hlee4\Verilog
file_x.v
file_y.v
The text file consists of the names of directories and the files in each directories. If the directory is empty, no files will be listed under it.
I have been trying to write a Perl script to remove the names of directories which has no files in it. I really have no idea how to do this.
The processed text should look like this:
.\hlee4\perl
file1.pl
file2.pl
file3.pl
.\hlee4\linux
file_a.txt
file_b.txt
.\hlee4\Verilog
file_x.v
file_y.v
with .\hlee4\unix and .\hlee4\C++ removed.
I have been looking at this for a few days now. HELP !!