views:

147

answers:

2

This is what I used:

for i in `find some -type f -name *.class`

I got:

some/folder/subOne/fileOne.class
some/folder/subOne/fileTwo.class
some/other/sub/file.class

next, I would like to get rid of the "some/" for each value of $i. What command can I use? Do I HAVE to save them into a file first?

Thanks

A: 

awk :) http://en.wikipedia.org/wiki/AWK

EDIT: Oh and you can pipe commands together, so the output of the first command acts as the input for the second. Like 'cat example.txt | less' will output the file through a paginator.

Al
+1  A: 
$ i=some/other/sub/file.class
$ echo ${i#some/}
other/sub/file.class

Bash has simple string manipulation built in. See also ${i%.class} and the basename and dirname commands.

Nelson
that's fastthank you!!!!
derrdji