DaemonForums  

Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 2nd February 2010
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,131
Default Taking your sed(1) skills beyond the easily swallowed 's/x/y/' porridge

1. Taking your sed(1) skills beyond the easily swallowed 's/x/y/' porridge
  • 1.1 Introduction
  • 1.2 Progressively cooking a nice 'al dente' 'sed' command file
  • 1.3 Modifying the '/etc/ttys' file


1.1 Introduction

The DESCRIPTION from the sed(1) man page:

Code:
The sed utility reads the specified files, or the standard input if no
files are specified, modifying the input as specified by a list of com-
mands.  The input is then written to the standard output.
Please note that 'sed' does not overwrite or change files. Some 'sed' versions, e.g. the GNU sed, allow you to overwrite the original.

A simple example. If we have a file with the following contents:

Code:
Dear Jennifer,

I miss your beautiful brown eyes. 
....
We can adapt this letter for our new love Sally, who has deep blue eyes.

Code:
$ sed -e 's/Jennifer/Sally/' -e 's/brown/blue/' letter.jennifer
Dear Sally,
        
I miss your beautiful blue eyes.
....
As stated sed(1) has modified the input and written it to standard output. For mailing this letter we have to redirect the outcome to file with something like $ sed -e 's/Jennifer/Sally/' -e 's/brown/blue/' letter.jennifer >letter.sally
Reply With Quote
 

Tags
sed, sed command file

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Xorg taking the fun out of BSD Carpetsmoker General software and network 122 6th December 2010 01:21 PM


All times are GMT. The time now is 11:09 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick