Find the answer to your Linux question:
Results 1 to 2 of 2
I want to match all filenames having a specific extension which is to be input by the user. I tried read ele # ele is the extension like txt,csv,log,doc,etc... ls ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2008
    Posts
    4

    Match input pattern with awk


    I want to match all filenames having a specific extension which is to be input by the user.

    I tried

    read ele # ele is the extension like txt,csv,log,doc,etc...
    ls -l | nawk -v z="\.$ele" '$9 ~ z {print}'

    But it does not work.

    Can anybody help....???

  2. #2
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    This should be sufficient IMHO:

    Code:
    ls *.ele

Posting Permissions

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