GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: change string in a file
Operating System - HP-UX
1849810
Members
1901
Online
104044
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
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
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
08-12-2007 06:41 PM
08-12-2007 06:41 PM
I have a file , the content is as below , all lines ended with .txt , I want to change all lines to .prn , I try to use the script (sed -e "s/.txt/.prn/" file > new_file) , but not work , can advise what can I do ? thx
$vi file
abc.txt
abd.txt
abe.txt
abf.txt
abg.txt
$vi file
abc.txt
abd.txt
abe.txt
abf.txt
abg.txt
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2007 06:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2007 07:18 PM
08-12-2007 07:18 PM
Re: change string in a file
u can use vi also for same.
%s/txt/prn/g
http://sunsite.uakom.sk/sunworldonline/swol-11-1997/swol-11-unix101.html
%s/txt/prn/g
http://sunsite.uakom.sk/sunworldonline/swol-11-1997/swol-11-unix101.html
It's kind of fun to do the impossible
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2007 07:34 PM
08-12-2007 07:34 PM
Re: change string in a file
>Awadhesh: you can use vi also for same.
%s/txt/prn/g
It would probably be safer to use:
%s/\.txt$/.prn/
Only get the extensions on the end of lines.
%s/txt/prn/g
It would probably be safer to use:
%s/\.txt$/.prn/
Only get the extensions on the end of lines.
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