View Full Version : removing first 2 characters of a path

02-19-2010, 12:08 PM
Hi everyone,

I'm using the command

find . -print

to list all files and their full directory path.
The output I get is whole directories but they all start with ./


Can somebody please help me to get rid of ./ at the beginning of each line?

Thank you very much

02-19-2010, 02:10 PM
That's a shell command. Where's your Perl code and Perl question?

02-19-2010, 02:10 PM
In general: if someone posts, that means that he doesn't know the answer. Isn't this forum for thoose who are like him? Or people comes here to ask and talk about what thay know?

In my opinion, every future user of this forum will be glad that goude asked something like this in this forum - not DDrive or somewhere else. Answers - most valuable think in every forum.

Correct me if im wrong...

02-19-2010, 02:46 PM

Your statements are difficult to read/understand.

The OP's question is a little vague in the respect that there is no indication which scripting language is being used. Is that find command being used in a shell or Perl script? If it's in a shell script, then I can move the question to the proper area. If it's in a Perl script, then we should look at that Perl code to see how it's being called and processed so that we can give better guidance on how to achieve the goal.

If it's a Perl script, then the File::Find module would be a better approach than shelling out to the find command.


02-19-2010, 03:28 PM
Sorry I posted in the wrong forum. My fault.

FishMonger is right this is a shell command not Perl.

By the way I figured it out.

I just used the cut command and it's sorted now.

cut -b 1-2 --complement file.txt

Thanks for looking.:)