Home » Guest » smart invesment ltd

smart invesment ltd

Business category 1 Food Agents
City ( of main office ) Onitsha, NG, Nigeria
Address 47 iweka road
Phones 234-70-38638394
Fax 234
About Newsgroups: alt.comp.editors.batch,comp.editors,comp.answers,alt.answers,news.answers
Subject: sed FAQ, version 015
Followup-To: poster
Summary: Frequently Asked Questions about sed, the stream editor
X-Disclaimer: Approval for *.answers is based on form, not content

Archive-Name: editor-faq/sed
Posting-Frequency: irregular
Last-modified: 10 March 2003
Version: 015
URL: http://sed.sourceforge.net/sedfaq.html
Maintainer: Eric Pement

THE SED FAQ

Frequently Asked Questions about
sed, the stream editor

CONTENTS

1. GENERAL INFORMATION
1.1. Introduction - How this FAQ is organized
1.2. Latest version of the sed FAQ
1.3. FAQ revision information
1.4. How do I add a question/answer to the sed FAQ?
1.5. FAQ abbreviations
1.6. Credits and acknowledgements
1.7. Standard disclaimers

2. BASIC SED
2.1. What is sed?
2.2. What versions of sed are there, and where can I get them?

2.2.1. Free versions

2.2.1.1. Unix platforms
2.2.1.2. OS/2
2.2.1.3. Microsoft Windows (Win3x, Win9x, WinNT, Win2K)
2.2.1.4. MS-DOS
2.2.1.5. CP/M
2.2.1.6. Macintosh v8 or v9

2.2.2. Shareware and Commercial versions

2.2.2.1. Unix platforms
2.2.2.2. OS/2
2.2.2.3. Windows 95/98, Windows NT, Windows 2000
2.2.2.4. MS-DOS

2.3. Where can I learn to use sed?

2.3.1. Books
2.3.2. Mailing list
2.3.3. Tutorials, electronic text
2.3.4. General web and ftp sites

3. TECHNICAL
3.1. More detailed explanation of basic sed
3.1.1. Regular expressions on the left side of "s///"
3.1.2. Escape characters on the right side of "s///"
3.1.3. Substitution switches
3.2. Common one-line sed scripts. How do I . . . ?

- double/triple-space a file?
- convert DOS/Unix newlines?
- delete leading/trailing spaces?
- do substitutions on all/certain lines?
- delete consecutive blank lines?
- delete blank lines at the top/end of the file?

3.3. Addressing and address ranges
3.4. Address ranges in GNU sed and HHsed
3.5. Debugging sed scripts
3.6. Notes about s2p, the sed-to-perl translator
3.7. GNU/POSIX extensions to regular expressions

4. EXAMPLES
ONE-CHARACTER QUESTIONS
4.1. How do I insert a newline into the RHS of a substitution?
4.2. How do I represent control-codes or non-printable characters?
4.3. How do I convert files with toggle characters, like +this+,
to look like [i]this[/i]?

CHANGING STRINGS
4.10. How do I perform a case-insensitive search?
4.11. How do I match only the first occurrence of a pattern?
4.12. How do I parse a comma-delimited (CSV) data file?
4.13. How do I handle fixed-length, columnar data?
4.14. How do I commify a string of numbers?
4.15. How do I prevent regex expansion on substitutions?
4.16. How do I convert a string to all lowercase or capital letters?

CHANGING BLOCKS (consecutive lines)
4.20. How do I change only one section of a file?
4.21. How do I delete or change a block of text if the block contains
a certain regular expression?
4.22. How do I locate a paragraph of text if the paragraph contains a
certain regular expression?
4.23. How do I match a block of specific consecutive lines?
4.23.1. Try to use a "/range/, /expression/"
4.23.2. Try to use a "multi-line\nexpression"
4.23.3. Try to use a block of "literal strings"
4.24. How do I address all the lines between RE1 and RE2, excluding the lines themselves?
4.25. How do I join two lines if line #1 ends in a [certain string]?
4.26. How do I join two lines if line #2 begins in a [certain string]?
4.27. How do I change all paragraphs to long lines?

SHELL AND ENVIRONMENT
4.30. How do I read environment variables with sed ...
4.31.1. ... on Unix platforms?
4.31.2. ... on MS-DOS or 4DOS platforms?
4.32. How do I export or pass variables back into the environment ...
4.32.1. ... on Unix platforms?
4.32.2. ... on MS-DOS
sed '1~3d' file
Date 2011 Oct 29, 09:10