#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    19
    Rep Power
    0

    How to insert a column to a text file in csh?


    I have a cron job to open a text file and insert a VARIABLE (dynamic).
    Example:

    OrigFile:
    A 1 B 2 C 3 D 4 041110

    UpdateFile:
    A 1 B 2 C 3 D 4 Date: 041110


    Since it's a cron job, so the script is written in csh.


    Thanks in advance.

    Thanh
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2004
    Location
    Middle Europa
    Posts
    1,198
    Rep Power
    18
    >>>>Since it's a cron job, so the script is written in csh.
    who said that s.*y ?
    cron never will use csh !
    the worst you can do in scriping is: use csh.
    when you need (sure) portability use bourne.

    y Q: sed 's/\(.*\) \(.*\)/\1 date: \2/' infile >outfile
    will do the job.

IMN logo majestic logo threadwatch logo seochat tools logo