awk assistance

Price, Erik eprice at ptc.com
Wed Nov 13 15:25:28 EST 2002


> -----Original Message-----
> From: pll at lanminds.com [mailto:pll at lanminds.com]
> Sent: Wednesday, November 13, 2002 3:15 PM
> To: Price, Erik
> Cc: pll at lanminds.com; gnhlug-discuss at gnhlug.org
> Subject: Re: awk assistance 
> 


> Obviously the 'find ./ -type f' portion could be replaced with
> 'cat findoutput.txt', but that's an extra shell process better done:
> 
> 	perl -e 'some perl code here' findoutput.txt


If you can believe it, I didn't even know that you could follow a
"perl -e" one liner with a file name and have it act on that file.


> Since I used the -F to set the split character to '/' and -a to turn 
> on autosplit mode, and -n create a loop around my code, what I end up 
> with is this:
> 
> 	while (<>) {
> 	   @F=split('/');
> 	   print $F[$#F];
> 	}

Wow ... that autosplitter is a timesaver alright.  I will definitely
remember to use that (with the -n flag too).  I learned more about
Perl in this post than I have in the past couple of weeks.

(Probably because I haven't been learning much about Perl in the past
couple of weeks, but what I'm trying to say is thanks for the tips.)




Erik



More information about the gnhlug-discuss mailing list