- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- 2 sed in one
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
Discussions
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
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
09-15-2005 06:48 AM
09-15-2005 06:48 AM
sed "s/north/south/ " input | sed "s/east/west/" >output
is there any way I can just use one sed?
I mean, is there anything like
sed -e "s/north/south/ " -e "s/east/west/" input >output
Solved! Go to Solution.
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2005 06:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2005 06:53 AM
09-15-2005 06:53 AM
Re: 2 sed in one
sed -e "1,\$s/north/south/ " -e "1,\$s/east/west/" input >output
to get the whole file processed
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2005 06:54 AM
09-15-2005 06:54 AM
Re: 2 sed in one
or you can use a file
file contanins
s/north/south/
s/east/west
then execute sed -f file input > output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2005 07:07 AM
09-15-2005 07:07 AM
Re: 2 sed in one
$cat repl.sed
s/north/south/
s/east/west/
sed -f repl.sed input > output
I realize that this is not necessary for only two expressions, so this is just an fyi in case you need.
I use these types in cases where I need a program to generate sed conditions for me dynamically, and then the sed needs be applied to a stream programmatically.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2005 07:35 AM
09-15-2005 07:35 AM
Re: 2 sed in one
thanks everyone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2005 03:17 PM
09-15-2005 03:17 PM
Re: 2 sed in one
perl -pe 's/one/ONE/;s/two/TWO/' input > output
If you want to update in the same file then,
perl -pi -e 's/one/ONE/;s/two/TWO/' input-same
hth.
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2005 08:41 PM
09-15-2005 08:41 PM
Re: 2 sed in one
use:
sed "s/north/south/;s/east/west/" input >output
Art