removal of files?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:
    remove all files and only files that the first three characters start with numerals.

  2. Relevant commands, code, scripts, algorithms:
    none

  3. The attempts at a solution (include all code and scripts):
    rm -ri [09-]*[!0-9]
    rm -ri [0-9]file
    rm -ri {0-9,0-9,0-9,a-z,A-Z}

  4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
    wastenaw community college, Ann arbro Michigan, Geyer, CIS121/Linux/Unix fundamentals

Side Note: I made files called [123file,675file 777file, and 1file] each time I do any of the codes listed above it will bring [1file] to the equation amd I just would like to know if you can't do this problem without that happening.
Thank you.
Note: I really like to try to figure out problems myself but I keep getting the same resaults I think the way I did this is the only way to do it just want to make sure(
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

I know in course section i am supposed to add comment but i think the following command is self-explicit enough
If you have adding question, please feel free to shoot

rm -ri [0-9][0-9][0-9]*

It worked thank you very much. I have no idea why I did'nt think of that. Thank you again.

Why does the problem statement contradict itself with "all and only"?

Why the -r to remove matching directories and their sub-trees?
Why the -i to ask for each?

rm [0-9][0-9][0-9]*

LoL DGP

You're true, i focused of the pattern ... i didn't even care of these options and just copied them like a stupid robot LoL ....

And what characters start with numerals :wink:

---------- Post updated at 21:49 ---------- Previous update was at 21:38 ----------

The description is quite ambiguous. You don't suppose what is meant is to remove only files that are regular files and not symbolic links or named pipes or what have you? In that case I think a find statement would be in order.

Or ls -l, sed, xargs:

ls -l | sed '
  s/^-.* \([0-9]\{3\}[^ ]*\)$/\1/
  t
  d
 ' | xargs -n 101 rm