Hey everyone,

I'm pretty unexperienced when it comes to SHELL scripting, and I'm having some issues with something. I'm trying to use a command that lists files within a directory with names that start with “t” or “f” and end with “3” or “2”. After that I will need to delete any files with names that begin with "f" within that same directory.

Any help would be greatly appreciated!

Thanks,
pennywise134

Recommended Answers

All 5 Replies

find . -depth 1 -name "[tf]*[32]" ... would do the job here, followed by ... rm f*.

This is all done within one directory, it didn't look like you wanted to be recursive...

Look up character classes in regular expressions.

Why find, ls does the job as well?
ls [tf]*[32]

It was the first thing that popped into my head...

I highly suggest this tutorial for helpful info when you're new to shell scripting.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.