find -E .-regex '.*.java$' The output are as follows, why there are './' in the beginning? How can I remove the './' in the output?
MacBook-Pro:Code fqyuan$ find -E . -regex '.*\.java$'
output is:
./GZIPcompress.java
./SubsetsII.java
./Ugly.java
find -E .-regex '.*.java$' The output are as follows, why there are './' in the beginning? How can I remove the './' in the output?
MacBook-Pro:Code fqyuan$ find -E . -regex '.*\.java$'
output is:
./GZIPcompress.java
./SubsetsII.java
./Ugly.java
You can use cut
to select only specific part of line:
find -E . -regex '.*\.java$' | cut -c3-
cut -c3-
will only select 3rd, 4th, 5th, ... characters only.
BTW, instead of using -E
and -regex
option, the find
command can be simplified using -name
option:
find . -name '*.java' | cut -c3-