Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. wardy66

    zip files in multiple directories

    Maybe pass in the directory name to awk (use the -v option) and then include this path name in the commands. Just a thought ... bed time here really :-)
  2. wardy66

    How to concatenate 2 files using awk

    Hi I'm not 100% sure what you are trying to achieve. To print the last field, just print $NF You probably want to get rid of the quotes, so you could try { last=$NF; gsub( /"/, "", last ); print last } That will get you the last bit of file 1 but I'm not sure how your file 2 is supposed to...
  3. wardy66

    Import Vertical Text records into Excel?

    Oops Just realised my code was a bit wrong. Change =~ s/ \s+ \z // to =~ s/ \s+ \z //xms The x in xms tells Perl to ignore spaces in the regex (the spaces either side of \s+) but it probably worked ok for you in this case but definitely change it.
  4. wardy66

    Do you know why my RE does not match my text

    Good point, Annihilannic - I thought I was on the Perl forum :-)
  5. wardy66

    Do you know why my RE does not match my text

    The bit of the regex event\)"[.\s]*onchange is failing because . inside [] is a real dot, not a match anything . Is that what you mean?
  6. wardy66

    Import Vertical Text records into Excel?

    Just a thought - do you want to print all the fields? If so, you could put a bit of code at the top to keep track of all the fields ever encountered. You might also want to replace the tab (\t) with a comma (,) in the print statement if you want CSV-like output. Keep in mind that CSV output...
  7. wardy66

    Import Vertical Text records into Excel?

    No worries It only prints 3 because I didn't bother typing them all in :-) This bit is the "culprit" qw( date time release ). Just add more field names if you like, in whatever order you like. Enjoy! Thanks for the star
  8. wardy66

    Import Vertical Text records into Excel?

    Hi RF101 You could probably do something with hashes use strict; use warnings; my @rows; # Contain each "record" my $row = -1; # Will be incremented to 0 shortly LINE: while (<>) { chomp; # Get the field name and rest of the line my ( $field_name, $field_val ) = unpack...
  9. wardy66

    Activestate library

    What sort of errors did you get? You should be able to download the modules, copy them to the server, extract them and "make" them without much hassle. I've installed stuff manually before when CPAN had trouble.
  10. wardy66

    After migration, it is significantly slow.

    Hi Han I don't use Activestate Perl very often and don't have it installed on this computer to test. But I think that perldoc is a command installed with Perl. Alternatively, you can get the doco all over the web, eg, http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlport.html A bit of light...
  11. wardy66

    After migration, it is significantly slow.

    Did you really need to change the slashes? Checkout perldoc perlport for hints on portable scripts.
  12. wardy66

    Another math question.

    Just as an aside, if all you're trying to do is create a lookup table for that maths function, you should check out the Memoize module. This allows the return value of subroutines to be cached for efficiency. So you would write your subroutine to do the int / 2 thing and Memoize would remember...
  13. wardy66

    keep only one line with the same value in column x

    That's what's called a UUOC :-) http://www2.cddc.vt.edu/jargon/html/U/UUOC.html
  14. wardy66

    Retrieving items from an array of hashes

    It looks like it's returning a reference to an array. So $result->[0]->{created_at} would equal 'Thu Feb 21 02:27:32 +0000 2008'. This means: [0] means first element in the array {created_at} hash entry with key of created_at Check out the perl man page for perlreftut On the web, it's at...
  15. wardy66

    Print minimum value in column

    You're both putting my dodgy solution to shame. Wish I'd delayed that coffee now :-)
  16. wardy66

    Print minimum value in column

    It's because min starts off like a 0 So nothing is lower Try adding something like BEGIN { min = 999 } but keep in mind that this is a bit of a kludge. If the lowest value is actually 1000 then it will print 999. So pick a big number, or to do it properly set min to the first value of $5 on...
  17. wardy66

    IPOD volume

    Are you using an Apple remote control on your iPod? I've noticed the volume misbehaves more when I use mine :-(
  18. wardy66

    Columns Manipulation using AWK

    do you want to overwrite cols 43 to 50 in file2? And leave col 1-42 alone? Does its format look the same as the example you gave?
  19. wardy66

    memory question (apparent leak)

    I have a feeling I read somewhere about "free" vs "inactive". I think inactive is effectively free. See if you can google something along those lines - it might not be the script's problem.
  20. wardy66

    Comparing multiline records

    Yeah, assoc array would be my suggestion too. Also, be careful about stripping spaces and punctuation from the name if you are using the name as an index.

Part and Inventory Search

Back
Top