checking if a file has a specified extension in csh
Hi guys,
How can i check if a file x has *.html extension using csh. I understand that csh is not the way to go, but i need to do it using csh. The code i have is this: Basically, given a directory the script iterates through the files in that directory and the files of its subdirectories. If a file has html extension, it will do something with that file. Code:
... Thanks grinch |
First of all, let me say "I understand". Specifically, the need to head off suggestions before they come. There will be the inevitable "you should use bash" and "perl could do it easy" and other similar comments. I hate that, and I try to put in as much "encouragement" in my questions to stop them from coming if they aren't acceptable solutions.
I won't mention any of those types of responses ;) There is another thread a few days back that touched on this. Here's the link. The post is about a bash script, but a reply further down gives a solution using sed. That's why I'm linking to it. The thread also brings up another point you did not elaborate on: what do you consider to be an extension? any and all text following the first period, any and all text following the last period, or something else? The sed command will change depending on your definition. |
cheers
Thanks for directing me to that post i found all the information i needed there. :)
grinch |
All times are GMT -5. The time now is 11:47 PM. |