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

    Join Date
    Mar 2003
    Posts
    2
    Rep Power
    0

    Bash Shell: cat/cp and cut/awk


    Hi.

    I'm writing a bash shell script which go through a large file and generate a large file.

    Does anyone know which is faster ?

    1. cut VS awk for stripping certain fields.

    2. cat old-file > new-file VS cp old-file new-file.


    Also, can anyone give a general direction on how to write bash shell script that run efficiently ?
    Like what is generall bad things to do...

    I know it is best to use built-in commands for bash but is there any other ?
    How about using many pipes and command substitution using backup quotes ?

    Thanks you.
  2. #2
  3. Introspective
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    3,317
    Rep Power
    110
    I keep seeing this post sitting here and I keep wondering how to reply.. but I just keep thinking 'Is there really going to be *any* appreciable difference?' my instincts tell me there isn't.

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

IMN logo majestic logo threadwatch logo seochat tools logo