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
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
08-19-2002 10:06 PM
08-19-2002 10:06 PM
I have a text file "abc" in which I want to substitute all the "/users/tiger" to "/rain/blue/violet"
In the file abc "/users/tiger" exists about 100 times.
Thanks,
Raje.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2002 10:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2002 10:18 PM
08-19-2002 10:18 PM
Re: vi
To change all occurances of /users/tiger to /rain/blue/violet.
vi the file and then:
:1,$s/\/users\/tiger/\/rain\/blue\/violet/g
HTH
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2002 10:21 PM
08-19-2002 10:21 PM
Re: vi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2002 10:37 PM
08-19-2002 10:37 PM
Re: vi
cat abc | sed 's/\users\/tiger/\rain\/blue\/violet/g' >abc.1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2002 11:07 PM
08-19-2002 11:07 PM
Re: vi
Using perl:
perl -pi -e 's+/users/tiger+/rain/blue/violet+g' filename
Rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2002 11:07 PM
08-19-2002 11:07 PM
Re: vi
As Procura recommend is better not to use cat:
sed 's/\users\/tiger/\rain\/blue\/violet/g' abc >abc.1
If you want to check the changes you can use grep:
grep "\/users\/tiger" abc
Regards,
Justo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2002 01:32 AM
08-20-2002 01:32 AM
Re: vi
:g/\/users\/tiger/s//\/rain\/blue\/violet/g
Regards,
Trond
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2002 02:41 AM
08-20-2002 02:41 AM
Re: vi
1,s_/users/tiger_/rain/blue/violet_g9999
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2002 04:08 AM
08-20-2002 04:08 AM
Re: vi
)
:g/search-string/s//replace-string/ global search and replace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2002 04:26 AM
08-20-2002 04:26 AM
Re: vi
Monica,
I was pointing out that the separator does not have to be a slash (/), and that an underscore (_) can easily be used (as any other character also). The point being that too many forward and backward slashes is just insanely crazy.
live free or die
harry