#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Melbourne, Australia
    Posts
    1
    Rep Power
    0

    Parsing directories


    I'm new to Unix but am trying to use awk to parse a directory to determine if the files in it are relevant.

    They are all named something like arch_1_xxx.arc where the xxx is a number.

    Can anyone offer me clues as to how to break up the file names?

    I thought I would `ls` the directory into a file and then parse the file...I've spent hours trying to work it out and well.....

    At the end of the process, I have to move relevant files to another location.
  2. #2
  3. Introspective
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    3,317
    Rep Power
    111
    you can do all that with shell, grep and xargs:

    [code]
    ls -al dirname | grep 'thing_to_match' | xargs command[code]

    probably not much help, but give us more info about what you're doing with these files and the answer is yours

    christo
    This is me: http://chris.uk.com

IMN logo majestic logo threadwatch logo seochat tools logo