Server Administration

  Home arrow Server Administration arrow Page 3 - Stream Editor in the UNIX Shell
SERVER ADMINISTRATION

Stream Editor in the UNIX Shell
By: Gabor Bernat
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-11-25

    Table of Contents:
  • Stream Editor in the UNIX Shell
  • How does it work?
  • Sed Addresses
  • Sed Commands
  • The hold space and whole scripts

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Stream Editor in the UNIX Shell - Sed Addresses


    (Page 3 of 5 )

    As I described earlier, before executing a sed command, the tool will check to see if the addresses correspond. This can be a concrete address, a range of addresses or a regular expression to match on the line. In the following table, you will find the methods for defining the addresses:

    Address

    What it means

    n

    The count starts from 1, and it will mean the n-th row.

    $

    The last line of the input

    /regex/

    It will match on the regex pattern.

    If there is a -r option for the tool, it will use the extended regular expressions, otherwise the regular one.

    /regex/I

    Just like the one above, with the difference that this will not match cases also.

    Address_1,Address_2

    Match all of the lines between the two addresses.

    Address_1~Address_2

    Start from Address_1 and stop with Address_2. So 1~2 will result in matching to all of the unpaired lines (1 3 5 7 ...)

    The addresses refer to lines (delimited with the new line => n character), and they include the borders. If the sed does not find the end of a range, it will skim through the whole stream. Appending the exclamation (!) character after the address will negate the address and refer to the complementing ones.

    In the last two methods, the address can be any of the first four, if you do not give an address prior to a sed command that will be executed for all the lines.

    More Server Administration Articles
    More By Gabor Bernat

    blog comments powered by Disqus

    SERVER ADMINISTRATION ARTICLES

    - Server Responses to Client Communication
    - Authentication in Client/Server Communication
    - Client/Server Communication
    - Understanding Awk in the UNIX Shell
    - Stream Editor in the UNIX Shell
    - Processes in the UNIX Shell
    - Migrating from Windows to Wine
    - Wine: Not Another Emulator
    - Preventive Measures to Block SSH Attacks
    - Monitoring Temperatures with Cacti
    - Cacti: RRDTool-based Graphing Solution
    - Network Magic 5.0 Review
    - Netfilter and Iptables Overview
    - Installing and Configuring Squid
    - Clickfree PC Backup Systems Compared


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 6 - Follow our Sitemap