Find the answer to your Linux question:
Results 1 to 2 of 2
Hey, Could someone help me write a simple script to: Get the name of each file (with a certain extension) in a folder Make a list of each file I ...
  1. #1
    Just Joined!
    Join Date
    Jul 2007
    Posts
    1

    Help writing a simple bash script

    Hey,


    Could someone help me write a simple script to:

    • Get the name of each file (with a certain extension) in a folder
    • Make a list of each file


    I would SO appreciate this. I'm a web developer myself so I understand how while and for loops (for example), work, but when it comes to scripting in other languages I'm pretty clueless...

    Thanks for any help.

  2. #2
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    Location
    CA, but from N.Ireland
    Posts
    2,413
    I can't tell if I'm helping someone with their homework, but here goes.
    Code:
    ls -1 *.txt | xargs cat
    Change the .txt to whatever extension you want.
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

Posting Permissions

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