Find the answer to your Linux question:
Results 1 to 2 of 2
I'm working on a script that does a little explanation of things once executed. I won't trouble with everything else, that's pretty much taken care of, but the main problem ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2010
    Posts
    6

    Format find output


    I'm working on a script that does a little explanation of things once executed.

    I won't trouble with everything else, that's pretty much taken care of, but the main problem is displaying the output of a find command in this manner:

    This is an absolute path: /data/dir1/subdir1/testfile1
    This is an absolute path: /data/dir1/subdir1/testfile10
    This is an absolute path: /data/dir1/subdir1/testfile2
    This is an absolute path: /data/dir1/subdir1/testfile3
    This is an absolute path: /data/dir1/subdir1/testfile4
    This is an absolute path: /data/dir1/subdir1/testfile5
    This is an absolute path: /data/dir1/subdir1/testfile6
    This is an absolute path: /data/dir1/subdir1/testfile7
    This is an absolute path: /data/dir1/subdir1/testfile8
    This is an absolute path: /data/dir1/subdir1/testfile9
    However I've only managed to spit this out:
    This is an absolute path: /data/dir1/subdir1/testfile1
    testfile10
    testfile2
    testfile3
    testfile4
    testfile5
    testfile6
    testfile7
    testfile8
    testfile9
    For this part of the script, I've been using this.
    echo -e "This is an absolute path: \c"
    find /data/dir1/subdir1/*
    any idea on how to get "This an absolute path: " to appear at the beginning of every line?

  2. #2
    Linux Enthusiast
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    649
    Look at piping the output of the "find" command into "sed" to change the begining of the line to the desired string. This is as close as I get to doing someone's homework assignment.

Posting Permissions

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