Unix questions - unix command help need it

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > February 2005 > unix command help need it





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author unix command help need it
puzzlecracker

2005-02-22, 5:53 pm

Give a Unix shell command that finds all occurences of the string
value=x in the temporary filesystem (/tmp) where x is an integer, and
prints the sum of all of the x's to standard output.

Stephane CHAZELAS

2005-02-22, 5:53 pm

2005-02-22, 07:26(-08), puzzlecracker:
> Give a Unix shell command that finds all occurences of the string
> value=x in the temporary filesystem (/tmp) where x is an integer, and
> prints the sum of all of the x's to standard output.

[...]

Assuming your shell is zsh:

perl -lne's/value=([-+]?\d+)/$n+=$1/ge}{print$n' /tmp/**/*(D.)

--
Stéphane
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com