- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- using ex in commandline for exchanging texts in a ...
Operating System - HP-UX
1752296
Members
5049
Online
108786
Solutions
Forums
Categories
Company
Local Language
юдл
back
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
юдл
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
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
тАО01-25-2001 08:51 AM
тАО01-25-2001 08:51 AM
Hallo to all
I'am looking for a comfortable way to replace all words "old" to "new" in a textfile without entering vi or ex interactively.
Sofar I started with
# ex +%s/old/new/g ..... my_text_file
This works allright but leaves me with the ex-prompt :
i.e. I have to enter :wq! to save the changes and return to my shell.
All attempts to add somewhat like | wq! did not work. How can I use ex to do the change and return to my shell without beeing prompted by ex?
All other ideas for one-line-solutions are welcome
thanks
I'am looking for a comfortable way to replace all words "old" to "new" in a textfile without entering vi or ex interactively.
Sofar I started with
# ex +%s/old/new/g ..... my_text_file
This works allright but leaves me with the ex-prompt :
i.e. I have to enter :wq! to save the changes and return to my shell.
All attempts to add somewhat like | wq! did not work. How can I use ex to do the change and return to my shell without beeing prompted by ex?
All other ideas for one-line-solutions are welcome
thanks
... we all can make it with a little help ...
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-25-2001 08:57 AM
тАО01-25-2001 08:57 AM
Re: using ex in commandline for exchanging texts in a file
Hi Klaus,
You should use 'sed' instead, as this one is a real 'stream editor'.
sed 's/old/new/g' < fromfile > tofile && mv tofile fromfile
You asked for a 'one liner', didn't you ? ;-)
Best regards,
Dan
You should use 'sed' instead, as this one is a real 'stream editor'.
sed 's/old/new/g' < fromfile > tofile && mv tofile fromfile
You asked for a 'one liner', didn't you ? ;-)
Best regards,
Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-25-2001 09:22 AM
тАО01-25-2001 09:22 AM
Re: using ex in commandline for exchanging texts in a file
do something like this:
ex - ${YOUR_FILE} <<-EOCFG
your edit commands
wq
EOCFG
ex - ${YOUR_FILE} <<-EOCFG
your edit commands
wq
EOCFG
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-25-2001 09:39 AM
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.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP