Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2009
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    removing first 2 characters of a path

    Hi everyone,

    I'm using the command
    Code:
    find . -print
    to list all files and their full directory path.
    The output I get is whole directories but they all start with ./

    i.e.
    Code:
    ./JBT_015/JBT_015_015
    Can somebody please help me to get rid of ./ at the beginning of each line?

    Thank you very much

  • #2
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,877
    Thanks
    2
    Thanked 164 Times in 159 Posts
    That's a shell command. Where's your Perl code and Perl question?

  • #3
    Regular Coder
    Join Date
    Feb 2010
    Posts
    208
    Thanks
    15
    Thanked 2 Times in 2 Posts
    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...

  • #4
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,877
    Thanks
    2
    Thanked 164 Times in 159 Posts
    auriaks,

    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.

    http://search.cpan.org/~dapm/perl-5....b/File/Find.pm

  • #5
    New Coder
    Join Date
    Jun 2009
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    Code:
    cut -b 1-2 --complement file.txt
    Thanks for looking.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •