in reply to Perl Parser, need help

The above approaches are probably more robust, but here's a quick & dirty alternative:
# DOS quoting: perl -ne "$contig=$1 if /^Sequence:\s+(\S+)/; print \"$contig $_\" if +$_!~/^(\S+:)/ && /\S/" dat.txt # *nix quoting: perl -ne '$contig=$1 if /^Sequence:\s+(\S+)/; print "$contig $_" if $_ +!~/^(\S+:)/ && /\S/' dat.txt
Either just redirect the output to a file (or pipe it elsewhere), or you could use the -i argument (man perlrun) as well.

Replies are listed 'Best First'.
Re^2: Perl Parser, need help
by QM (Parson) on May 15, 2005 at 03:23 UTC
    Maybe it's just too late in my caffeine cycle, but I didn't think you could simply escape double-quotes in DOS, can you? That would make it too easy, and I'm pretty sure I remember otherwise.

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

      I too was shocked to see it work, and yesterday was a caffeine-less day for me, so it must be true! Yesterday was on win2k -- i just tried it with success on win98 as well!
      C:\temp>echo "blah \" ad" "blah \" ad" C:\temp>echo blah \" ad blah \" ad