[HPADM] [SUMMARY] Unix shell
From: Ben Le (ble_at_pcc.edu)
Date: 12/03/03
- Previous message: Ben Le: "[HPADM] Unix shell"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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)
- Previous message: Ben Le: "[HPADM] Unix shell"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|