- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: help me with search & replace string (quoting)
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
Discussions
Discussions
Forums
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
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
тАО06-15-2012 04:13 AM
тАО06-15-2012 04:13 AM
Re: help me with search & replace string (quoting)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-15-2012 11:31 AM - edited тАО06-15-2012 06:15 PM
тАО06-15-2012 11:31 AM - edited тАО06-15-2012 06:15 PM
Re: help me with search & replace string (quoting)
>And this is the error I am having when I run:
This is the same error that Steven told you how to fix before and again just now.
>file="/tmp/fr/danilo/"
>sed "s/$string1/$string2/g" $file > $file.new
Your assignment to "file" above isn't going to work since will be treated as a directory path when adding ".new".
If you do want to scan/change mass quantities, you need to tell us how you find those 30,000 files.
Also, the above code changes the file modification date, even if the string isn't found. Do you want to not change the dates on those?
>If you do get the quotation marks into string1 and string2, what do you think will happen when you add more quotation marks to them, as in: "s/$string1/$string2/g"
I'm not sure of your point? If I got those double quotes into the strings (using single quotes), I had no problems with the sed command. (At least with bash. And a real shell works too.)
I wasn't sure so I explicitly checked it. Reading the man page briefly may not provide enough detail to figure out what it does, so experiments are also helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-15-2012 02:55 PM
тАО06-15-2012 02:55 PM
Re: help me with search & replace string (quoting)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-15-2012 06:15 PM
тАО06-15-2012 06:15 PM
Re: help me with search & replace string (quoting)
>It works for me, too. My usual quotation paranoia must be getting out of control.
Yes, I didn't think it would be that easy either.
It appears once something is quoted, it doesn't matter what the variables inside expand to.
Or course programs like sed and grep may need even more quoting. :-)
- « Previous
-
- 1
- 2
- Next »