Need help with a script that looks for contents of a file
Inside of the directory /etc/lp/printers we have many subdirectories which define printers, ie:
/etc/lp/printers/printer1 /etc/lp/printers/printer2 /etc/lp/printers/printer3 /etc/lp/printers/printer4 ... ... /etc/lp/printers/printer50 within each of those subdirectories is a file called "comment". ie: /etc/lp/printers/printer1/comment I need a script that will go through all the "comment" files for all of the printers and output the contents of every "comment" files that start with the letter U . I tried messing around with some bash for a couple hours and i'm back at square 1. Thanks, Ryan |
Quote:
|
The first character of the first line is a "U".
Thanks, Ryan |
Well, you can find the list of files using find. The -name option will do this:
Code:
find /etc/lp/printers -name comment Code:
... | while read filename; do ... done Code:
perl -ne 'if ( $_ =~ /^U/ ) { exit 0; } else { exit 1; }' |
Quote:
thanks.. that did the trick. i need to really take a week off and learn bash. :study: |
bash is the glue, the standard utilities do most of the work. It's just such a useful system, I feel the daily need to thank my lucky stars for the *nix way.
|
All times are GMT -5. The time now is 05:58 AM. |