Find the answer to your Linux question:
Results 1 to 5 of 5
I need a sed command to to print a list of files in "/home" directory, ending in ".sh"...
  1. #1
    Just Joined!
    Join Date
    May 2009
    Posts
    2

    need a sed command

    I need a sed command to to print a list of files in "/home" directory, ending in ".sh"

  2. #2
    Linux Newbie
    Join Date
    Jul 2005
    Location
    Australia (Down Under)
    Posts
    141
    I know you have asked for a sed command, but does it have to be a sed command? i believe that you can use grep for this.

    try something like
    Code:
    ls $HOME | grep '.sh'
    I haven't had a chance to test this, but i believe that it would work.
    Linux is the OS of tomorrow, Here today!!

  3. #3
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568

    Smile

    sed command used for find and replace a text/string in file


    files in "/home" directory
    Generally /home contains all users home,something like
    /home/lakshmipathi
    /home/lg
    If you just want to list files from your home directory use ls command

    ls -l ~/*.sh

    you can use /home/your_login instead of ~

    to know more about ls or find command from terminal type
    man ls
    man find
    HTH
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

  4. #4
    Just Joined!
    Join Date
    May 2009
    Posts
    2
    Thanks for your replies...but actually I need to use "sed" command only.....I could have used grep or awk better...but I am tied

  5. #5
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568
    Quote Originally Posted by dev_scripts View Post
    Thanks for your replies...but actually I need to use "sed" command only.....I could have used grep or awk better...but I am tied

    I'm confused ...sed ? what's are trying to do? are you parsing list file name from text file ?
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

Posting Permissions

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