- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- find and replace
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 07:59 AM
03-19-2002 07:59 AM
find and replace
replace "/home/emorales" with the string
"/usr/local/bin"
I am using sed command it is complaining about the "/".
sed -e 's/"/home/emorales"/"/usr/local/bin"/g' filename
Does anyone out there give me some help?
By the way this unix 11.0
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 08:02 AM
03-19-2002 08:02 AM
Re: find and replace
Put the / it complains about as \/
sed -e 's/\/usr/\/lala/' file
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 08:03 AM
03-19-2002 08:03 AM
Re: find and replace
USE underscores (_)
You know you have to redirect the output to another filename, DO NOT USE THE ORIGINAL filename because it will clobber the process.
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 08:57 AM
03-19-2002 08:57 AM
Re: find and replace
# perl -pi -e 's:/"/home/emorales":"/usr/local/bin":g' filename
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 02:00 PM
03-19-2002 02:00 PM
Re: find and replace
I tried it using the sed command.
Here is what I got:
$ echo "/home/emorales" | sed 's/home\/emorales/usr\/local\/bin/'
/usr/local/bin
Hope it helps.
-Louis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 11:01 PM
03-19-2002 11:01 PM
Re: find and replace
sed -e 's/\/home\/user/\/home\/userabc/g'
- - - -
This will tell to treat the next character as a normal symbol.
Hope this helps.
Kenny.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 11:12 PM
03-19-2002 11:12 PM
Re: find and replace
:g/\/home\/emorales/s//\/usr\/local\/bin/g
Regards,
Trond
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 11:49 PM
03-19-2002 11:49 PM
Re: find and replace
#
# replace text in file
#
# by bill mcnamara wimac@tidhom1g.grenoble.hp.com wma@teamlog.com
#set -x
if [ $# -lt 3 ];
then
echo "$0 old new /file.xml"
exit 1
fi
typeset OLD=$1
typeset NEW=$2
typeset FILE=$3
# cleanup
# kludge for sed end of file 'bug'
echo "" >> $FILE
# don't want to look at binaries
sed "s:$OLD:$NEW:g" $FILE > ${FILE}.bak
cp $FILE.bak $FILE
# summarise
#.end.