I need a script to remove lines from a file.

Hi,
    I work for an automotive group, and I need some help with a report file that we send out. The following is a sample.

S ORD/STK#  YEAR MAKE       MODEL      SERIES   BODY TYPE  D/S VIN
- --------- ---- ---------- ---------- -------- ---------- --- -----------------

W *0360089A 2004 ACURA      TL                  4DR SDN     13 19UUA65544A046034
R  003P1000 2003 ACURA      3.2TL               4DR SDN     42 19UUA56623A080487

It goes for about a page, and the the first two lines repeat themselves. I need the lines with the dashes removed, without disrupting the file otherwise.
I would appreciate the help, as I am just to busy to pull out my perl book, and hack this out. Thanks.
LVL 3
nalanbarAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wlfsCommented:
unix:
perl -ne 'print unless m/^[\s-]$/' <infile.txt >outfile.txt

windows:
perl -ne "print unless m/^[\s-]$/" <infile.txt >outfile.txt
nalanbarAuthor Commented:
I ran the script, but the output still has the dashes...
Suhas .Senior QA ManagerCommented:
Hi nalanbar,
#!/usr/bin/perl

open(IN,"D://test.txt");
open(OUT,">D://test_res.txt");
@arr = <IN>;
foreach $i (@arr) {
@arr1 = split(//,$i);
#print @arr1;
foreach $j (@arr1) {
    print "$j\n";
    if($j ne "-"){
        print OUT $j;}
    }
   
}

input (file.txt):
khihkhdashd
--------
hdifhdhf00---

output(file_res.txt):
khihkhdashd

hdifhdhf00

Cheers!
Suhas
wlfsCommented:
Sorry, you are of course right. I forgot the quantifier. In order to keep blank lines in, it becomes a little bit more elaborate:
perl -ne 'print unless m/^\s*-+[\s-]*$/' <infile.txt >outfile.txt

I ran and tested it, so it should work fine now.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.