GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- replace string in files
Operating System - HP-UX
1851986
Members
2865
Online
104063
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
back
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
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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-05-2003 02:22 AM
03-05-2003 02:22 AM
replace string in files
used to replace a certain string in a file-list. basically just provides a shell for sed - for the leyman user.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2003 04:34 AM
03-05-2003 04:34 AM
Re: replace string in files
Hi try this ->
for i in `ls /somedir`
do
sed -e s/oldstring/newstring/ ${i} > ${i}.tmp
mv ${i}.tmp ${i}
done
Note that the for statement uses the glitch key located above the tab key.
hth,
Tom
for i in `ls /somedir`
do
sed -e s/oldstring/newstring/ ${i} > ${i}.tmp
mv ${i}.tmp ${i}
done
Note that the for statement uses the glitch key located above the tab key.
hth,
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2003 05:16 AM
03-05-2003 05:16 AM
Re: replace string in files
The glitch key (aka, reverse apostrophe or grave accent) is considered to be obsolete (archaic in man-speak). A better way for command substitution (and far less likely to be mis-typed) is the $(command-list) format as in:
for i in $(ls /somedir)
This is especially helpful with non-English keyboards or with faxes that are a bit dusty.
Bill Hassell, sysadmin
for i in $(ls /somedir)
This is especially helpful with non-English keyboards or with faxes that are a bit dusty.
Bill Hassell, sysadmin
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP