[HPADM] [SUMMARY] Unix shell

From: Ben Le (ble_at_pcc.edu)
Date: 12/03/03

  • Next message: Patel Pankaj: "[HPADM] disk swapping with data"
    Date: Tue, 02 Dec 2003 15:27:12 -0800
    To: hpux-admin@dutchworks.nl
    
    

    Is this list great or what? Who need Unix class since we have this list?
    Thanks to:
    david.totsch@hp.com
    bill.thompson@goodyear.com
    knikifor@epcor.ca
    alexvi@ix.netcom.com
    hartman@dutita3.twi.tudelft.nl
    Allan.Marillier@dana.com
    and OTHER Experts...

    Question:
    I'd like to replace 'blue' with 'red' in file 'month.log' in 3000+ users
    directories. All users are under /home directory. How do I do this. Thanks
    for your help.

    Solution:

    for DIR in /home/*
    do
    sed s/blue/red/g $DIR/month.log > $DIR/newmonth.log
    mv $DIR/newmonth.log $DIR/month.log
    done
    --------------------------------------------
    cd /home
    for FILE in */month.log; do
    ex $FILE >/dev/null <<EOF
    %s/blue/red/g
    wq!
    EOF
    done
    ---------------------------------------------
    perl -p -i -e 's/original text string/replacementstring/g' foo
    ---------------------------------------------
    #!/usr/bin/sh
    sed -e "s/blue/red/g" $1 > /tmp/sed.temp$$
    if [ $? ]; then # only when the sed went ok!
    mv /tmp/sed.temp$$ $1
    fi
    ----------------------------------------------

    __________________________________________
    Benjamin Le
    Sr. Systems Administrator
    Information Technology Services
    Portland Community College
    Voice:(503)-977-4736 Fax:(503)-977-4987
    Mailto:ble@pcc.edu http://www.pcc.edu

    --
                 ---> Please post QUESTIONS and SUMMARIES only!! <---
            To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
           Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
     
     Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
                http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)
    

  • Next message: Patel Pankaj: "[HPADM] disk swapping with data"

    Relevant Pages

    • [HPADM] Fwd: [SUMMARY] Find command
      ... >Benjamin Le ... Systems Administrator ... >Information Technology Services ... >Portland Community College ...
      (HP-UX-Admin)
    • [HPADM] Re: Users not active
      ... Systems Administrator ... Information Technology Services ... Portland Community College ... To subscribe/unsubscribe to this list, ...
      (HP-UX-Admin)
    • [HPADM] [SUMMARY] Xterm for HP OVO/ITO
      ... Benjamin Le ... Systems Administrator ... Information Technology Services ... Portland Community College ...
      (HP-UX-Admin)
    • [HPADM] hp-ux lp
      ... Benjamin Le ... Systems Administrator ... Information Technology Services ... Portland Community College ...
      (HP-UX-Admin)