UNIX Text Processing Tools—Programs for Sorting, Compar- Ing, and in Various Ways Examining the Contents of Text Files

Total Page:16

File Type:pdf, Size:1020Kb

UNIX Text Processing Tools—Programs for Sorting, Compar- Ing, and in Various Ways Examining the Contents of Text Files UNIX® TEXT PROCESSING DALE DOUGHERTY AND TIM O’REILLY and the staffofO’Reilly & Associates, Inc. CONSULTING EDITORS: Stephen G. Kochan and PatrickH.Wood HAYDEN BOOKS ADivision of HowardW.Sams & Company 4300 West 62nd Street Indianapolis, Indiana 46268 USA Copyright © 1987 Dale Dougherty and Tim O’Reilly FIRST EDITION SECOND PRINTING — 1988 INTERNET "UTP Revival" RELEASE — 2004 The UTP RevivalRelease is distributed according to the terms of the Creative Commons Attribution License. A copyofthe license is available at http://creativecommons.org/licenses/by/1.0 International Standard Book Number: 0-672-46291-5 Library of Congress Catalog Card Number: 87-60537 Trademark Acknowledgements All terms mentioned in this book that are known to be trademarks or service marks are listed below. Nei- ther the authors nor the UTP Revivalmembers can attest to the accuracyofthis information. Use of a term in this book should not be regarded as affecting the validity of anytrademark or service mark. Apple is a registered trademark and Apple LaserWriter is a trademark of Apple Computer,Inc. devps is a trademark of Pipeline Associates, Inc. Merge/286 and Merge/386 are trademarks of Locus Computing Corp. DDL is a trademark of Imagen Corp. Helvetica and Times Roman are registered trademarks of Allied Corp. IBM is a registered trademark of International Business Machines Corp. Interpress is a trademark of Xerox Corp. LaserJet is a trademark of Hewlett-Packard Corp. Linotronic is a trademark of Allied Corp. Macintosh is a trademark licensed to Apple Computer,Inc. Microsoft is a registered trademark of Microsoft Corp. MKS Toolkit is a trademark of Mortice Kern Systems, Inc. Multimate is a trademark of Multimate International Corp. Nutshell Handbook is a trademark of O’Reilly & Associates, Inc. PC-Interface is a trademark of Locus Computing Corp. PostScript is a trademark of Adobe Systems, Incorporated. PageMaker is a registered trademark of Aldus Corporation. SoftQuad Publishing Software and SQtroffare trademarks of SoftQuad Inc. WordStar is a registered trademark of MicroPro International Corp. UNIX is a registered trademark of The Open Group. VP/ix is a trademark of Interactive Systems Corp. and Phoenix Technologies, Ltd. CONTENTS Preface xi 1 From Typewriters to Word Processors 1 AWorkspace ..............................................................................................................................................2 Tools for Editing........................................................................................................................................3 Document Formatting ................................................................................................................................4 Printing ......................................................................................................................................................6 Other UNIX Text-Processing Tools ...........................................................................................................7 2 UNIX Fundamentals 9 The UNIX Shell.........................................................................................................................................9 Output Redirection ..................................................................................................................................10 Special Characters ...................................................................................................................................14 Environment Variables ............................................................................................................................15 Pipes and Filters ......................................................................................................................................16 Shell Scripts.............................................................................................................................................17 3 Learning vi 19 Session 1: Basic Commands....................................................................................................................19 Opening a File .........................................................................................................................................20 Moving the Cursor...................................................................................................................................22 Simple Edits.............................................................................................................................................25 Session 2: Moving Around in a Hurry ....................................................................................................32 Movement by Screens .............................................................................................................................32 Movement by TextBlocks .......................................................................................................................34 Movement by Searches............................................................................................................................35 Movement by Line Numbers...................................................................................................................37 Session 3: Beyond the Basics .................................................................................................................38 Command-Line Options ..........................................................................................................................38 Customizing vi.......................................................................................................................................40 Edits and Movement ................................................................................................................................42 More Ways to Insert Text........................................................................................................................43 Using Buffers ...........................................................................................................................................43 Marking Your Place.................................................................................................................................45 Other Advanced Edits..............................................................................................................................46 4 nroff and troff 47 What the Formatter Does.........................................................................................................................48 Using nroff...........................................................................................................................................51 Using troff...........................................................................................................................................51 The Markup Language ............................................................................................................................54 Turning Filling On and Off......................................................................................................................55 Controlling Justification ..........................................................................................................................57 v vi Unix TextProcessing Hyphenation ............................................................................................................................................59 Page Layout .............................................................................................................................................60 Page Transitions .......................................................................................................................................70 Changing Fonts ........................................................................................................................................74 AFirst Look at Macros............................................................................................................................81 5 The ms Macros 85 Formatting a TextFile with ms ...............................................................................................................86 Page Layout .............................................................................................................................................86 Paragraphs ...............................................................................................................................................87 Changing Font and Point Size .................................................................................................................93 Displays ...................................................................................................................................................97 Headings ..................................................................................................................................................99 CoverSheet Macros...............................................................................................................................100 Miscellaneous Features .........................................................................................................................102 Page Headers and Footers ......................................................................................................................104
Recommended publications
  • Darwin Release 3.0.1
    Using Darwin Release 3.0.1 Thinking Machines Corporation First printing, May 1998 The information in this document is subject to change without notice and should not be construed as a commitment by Thinking Machines Corporation. Thinking Machines reserves the right to make changes to any product described herein. Although the information in this document has been reviewed and is believed to be reliable, Thinking Machines Corporation assumes no liability for errors in this document. Thinking Machines does not assume any liability arising from the application or use of any information or product described herein. Thinking Machines and Darwin are registered trademarks of Thinking Machines Corporation. Note: Darwin" is a registered trademark of Thinking Machines Corporation in the United States. Darwin" is a registered trademark of Science in Finance Ltd. in the United Kingdom. Therefore Darwin" is not available from Thinking Machines Corporation in the United Kingdom. In the United Kingdom, Thinking Machines Corporation sells its product under the name LoyaltyStream." HPĆUX and HPĆUX 10.20 are trademarks of HewlettĆPackard Company. INFORMIX is a trademark of Informix Software, Inc. InstallShield is a trademark of InstallShield Corporation. INTERSOLV is a trademark of INTERSOLV, Inc. Microsoft, Windows, Windows NT, and Windows 95 are trademarks of Microsoft Corporation. Oracle is a trademark of Oracle Corporation. Open Windows is a trademark of Sun Microsystems, Inc. Sun, Solaris, Sun Ultra, Ultra, and Sun Workstation are trademarks of Sun Microsystems, Inc. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc., in the United States and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc.
    [Show full text]
  • Cygwin User's Guide
    Cygwin User’s Guide Cygwin User’s Guide ii Copyright © Cygwin authors Permission is granted to make and distribute verbatim copies of this documentation provided the copyright notice and this per- mission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this documentation under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this documentation into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation. Cygwin User’s Guide iii Contents 1 Cygwin Overview 1 1.1 What is it? . .1 1.2 Quick Start Guide for those more experienced with Windows . .1 1.3 Quick Start Guide for those more experienced with UNIX . .1 1.4 Are the Cygwin tools free software? . .2 1.5 A brief history of the Cygwin project . .2 1.6 Highlights of Cygwin Functionality . .3 1.6.1 Introduction . .3 1.6.2 Permissions and Security . .3 1.6.3 File Access . .3 1.6.4 Text Mode vs. Binary Mode . .4 1.6.5 ANSI C Library . .4 1.6.6 Process Creation . .5 1.6.6.1 Problems with process creation . .5 1.6.7 Signals . .6 1.6.8 Sockets . .6 1.6.9 Select . .7 1.7 What’s new and what changed in Cygwin . .7 1.7.1 What’s new and what changed in 3.2 .
    [Show full text]
  • Introduction to Unix (PDF)
    Introduction to… UNIX Bob Booth December 2004 AP-UNIX2 © University of Sheffield Contents 1. INTRODUCTION....................................................................................................................................... 3 1.1 THE SHELL ........................................................................................................................................... 3 1.2 FORMAT OF COMMANDS ...................................................................................................................... 4 1.3 ENTERING COMMANDS ......................................................................................................................... 4 2. ACCESSING UNIX MACHINES ............................................................................................................. 5 2.1 TERMINAL EMULATION SOFTWARE...................................................................................................... 5 2.2 LOGGING IN.......................................................................................................................................... 6 2.3 LOGGING OUT ...................................................................................................................................... 6 2.4 CHANGING YOUR PASSWORD............................................................................................................... 8 3. BASIC UNIX COMMANDS...................................................................................................................... 9 3.1 FILENAMES..........................................................................................................................................
    [Show full text]
  • “Add-On-Packages” in R Installation and Administration
    R Installation and Administration Version 2.15.3 Patched (2013-03-03) R Core Team Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the con- ditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another lan- guage, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the R Core Team. Copyright c 2001{2012 R Core Team ISBN 3-900051-09-7 i Table of Contents 1 Obtaining R ::::::::::::::::::::::::::::::::::::: 1 1.1 Getting and unpacking the sources ::::::::::::::::::::::::::::: 1 1.2 Getting patched and development versions :::::::::::::::::::::: 1 1.2.1 Using Subversion and rsync:::::::::::::::::::::::::::::::: 1 2 Installing R under Unix-alikes ::::::::::::::::: 3 2.1 Simple compilation ::::::::::::::::::::::::::::::::::::::::::::: 3 2.2 Help options ::::::::::::::::::::::::::::::::::::::::::::::::::: 4 2.3 Making the manuals:::::::::::::::::::::::::::::::::::::::::::: 4 2.4 Installation :::::::::::::::::::::::::::::::::::::::::::::::::::: 6 2.5 Uninstallation :::::::::::::::::::::::::::::::::::::::::::::::::: 8 2.6 Sub-architectures::::::::::::::::::::::::::::::::::::::::::::::: 8 2.6.1 Multilib
    [Show full text]
  • The Kdiff3 Handbook the Kdiff3 Handbook
    The KDiff3 Handbook The KDiff3 Handbook 2 Contents 1 Introduction 7 1.1 Yet Another Diff Frontend? . .7 1.2 Screenshots and Features . .7 1.3 More Features . .9 1.3.1 Line-By-Line And Char-By-Char Diff-Viewer . .9 1.3.2 See White-Space Differences At One Glance . .9 1.3.3 Triple-Diff . .9 1.3.4 Comfortable Merge Of Two Or Three Input Files . 10 1.3.5 And ... 10 2 File Comparison And Merge 11 2.1 Command-Line Options . 11 2.1.1 Comparing 2 files: . 11 2.1.2 Merging 2 files: . 11 2.1.3 Comparing 3 files: . 11 2.1.4 Merging 3 files: . 11 2.1.5 Special case: Files with the same name . 11 2.1.6 Commandline for starting a folder comparison or merge: . 12 2.1.7 Other command line options . 12 2.1.8 Ignorable command line options . 12 2.2 Open-Dialog . 13 2.3 Paste and Drop Input . 13 2.4 Comparing Files And Interpreting The Information In The Input Windows . 14 2.4.1 Info Line . 14 2.4.2 Coloring . 14 2.4.3 Summary Column . 15 2.4.4 Overview Column . 15 2.4.5 Manually Aligning Lines . 15 2.4.6 Manually Joining and Splitting Diff Sections . 15 2.5 Merging And The Merge Output Editor Window . 16 2.5.1 The Summary Column . 16 The KDiff3 Handbook 2.5.2 Setting The Current Group And Synchronising Merge And Diff View Position 16 2.5.3 Choosing Inputs A, B or C For Current Conflict And Editing .
    [Show full text]
  • Installation Guide
    Installation Guide Installation Guide Schrödinger Suite 2011 Schrödinger Press Installation Guide Copyright © 2011 Schrödinger, LLC. All rights reserved. While care has been taken in the preparation of this publication, Schrödinger assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. Canvas, CombiGlide, ConfGen, Epik, Glide, Impact, Jaguar, Liaison, LigPrep, Maestro, Phase, Prime, PrimeX, QikProp, QikFit, QikSim, QSite, SiteMap, Strike, and WaterMap are trademarks of Schrödinger, LLC. Schrödinger and MacroModel are registered trademarks of Schrödinger, LLC. MCPRO is a trademark of William L. Jorgensen. Desmond is a trademark of D. E. Shaw Research. Desmond is used with the permission of D. E. Shaw Research. All rights reserved. This publication may contain the trademarks of other companies. Schrödinger software includes software and libraries provided by third parties. For details of the copyrights, and terms and conditions associated with such included third party software, see the Legal Notices, or use your browser to open $SCHRODINGER/docs/html/third_party_legal.html (Linux OS) or %SCHRODINGER%\docs\html\third_party_legal.html (Windows OS). This publication may refer to other third party software not included in or with Schrödinger software ("such other third party software"), and provide links to third party Web sites ("linked sites"). References to such other third party software or linked sites do not constitute an endorsement by Schrödinger, LLC. Use of such other third party software and linked sites may be subject to third party license agreements and fees. Schrödinger, LLC and its affiliates have no responsibility or liability, directly or indirectly, for such other third party software and linked sites, or for damage resulting from the use thereof.
    [Show full text]
  • Awingu-4.3-Admin-Guide.Pdf
    Awingu Admin Guide Version 4.3 1 1. Document Guidance . 3 2. Installation . 4 2.1 Connectivity Requirements . 5 2.2 Sizing & Scaling Requirements . 7 2.3 Deployment . 11 2.3.1 Deployment on Microsoft Hyper-V . 12 2.3.2 Deployment on VMware ESXi with vSphere Client on Windows . 21 2.3.3 Deployment on VMware ESXi with vSphere Web Client . 33 2.3.4 Deployment on Linux KVM . 40 2.3.5 Deployment on Microsoft Azure . 48 2.3.6 Deployment on Amazon EC2 . 49 2.3.7 Deployment on Google Compute . 50 2.4 Awingu Installer . 51 2.5 Azure Awingu All-In-One . 57 3. System Settings . 62 3.1 System Settings - Global . 63 3.1.1 Connectivity Settings . 64 3.1.2 General Information . 68 3.1.3 Service Management Settings . 72 3.1.4 Domain Settings . 74 3.1.5 Certificate Settings . 77 3.1.6 Troubleshoot . 80 3.2 System Settings - Configure . 84 3.2.1 Branding Configuration . 85 3.2.2 Feature Configuration . 88 3.2.3 User Connector Configuration . 91 3.3 System Settings - Manage . 99 3.3.1 Application Management . 100 3.3.2 Application Server Management . 114 3.3.3 Category Management . 117 3.3.4 Drive Management . 118 3.3.5 File Type Management . 121 3.3.6 Label Management . 123 3.3.7 User Management . 128 3.4 System Settings - Change Log . 129 3.5 Service Provider Support in Awingu . 131 4. Monitoring and Reporting . 137 4.1 Status Overview of Services on All Servers . 138 4.2 Monitoring Servers and Components .
    [Show full text]
  • DOCUMENT RESUME Focus on the Customer. New Opportunities for 81P
    DOCUMENT RESUME ED 401 858 HE 029 711 TITLE Focus on the Customer. New Opportunities for Partnering, CAUSE94. Track II. INSTITUTION CAUSE, Boulder, Colo. PUB DATE 95 NOTE 81p.; In: New Opportunities for Partnering. Proceedings of the 1994 CAUSE Annual Conference (Orlando, Florida, November 29-December 2, 1994); see HE 029 709. AVAILABLE FROM CAUSE Information Resources Library, 4840 Pearl East Circle, Suite 302E, Boulder, CO 80303 (Individual papers available to CAUSE members at cost of reproduction). PUB TYPE Reports Descriptive (141) Speeches/Conference Papers (150) EDRS PRICE MF01/PC04 Plus Postage. DESCRIPTORS College Administration; College Libraries; Colleges; *Computer Networks; Computers; Cooperation; Cooperative Programs; Educational Planning; Higher Education; *Information Management; *Information Networks; Information Systems; *Information Technology; Models; *Partnerships in Education; Student Personnel Services; Universities IDENTIFIERS Boston College MA; Campus Wide Information Systems; *CAUSE National Conference; *Customer Relations; Maricopa County Community College District AZ; Southwest Texas State University ABSTRACT Eight papers are presented from the 1994 CAUSE conference track on customer-centered partnering within and among higher education institutions in regard to information resources and technology. The papers include:(1) "Customer-Centered Collaboration: Libraries and IT," which focuses on the use of teams, total quality management, and business process reengineering (Geri Bunker and Barbara Horgan);(2) "Making Order Out of Chaos with a Computerized Lottery," which discusses the use of a class scheduling lottery at the Massachusetts Institute of Technology (Steven Anders Oakland); (3) "Customers as Partners in the Information Technology Planning Process," which describes the development of the Information Technology Planning Project at the University of Minnesota (Linda Jorn and others);(4) "Distance Education: What's Up," which focuses on new trends in distance education (Gene T.
    [Show full text]
  • View the Slides
    SMB3.1.1 POSIX Protocol Extensions: Summary and Current Implementation Status Steve French Azure Storage – Microsoft Samba Team And SMB Jeremy Allison Google/Samba Team 3.1.1 Legal Statement This work represents the views of the author(s) and does not necessarily reflect the views of Microsoft or Google Linux is a registered trademark of Linus Torvalds. Other company, product, and service names may be trademarks or service marks of others. Outline Linux is a lot more than POSIX ... Why do these extensions matter? Implementation Status What works today? Some details How to handle Linux continuing to extend APIs? Wireshark and Tracing Linux > POSIX Currently huge number of syscalls! (try “git grep SYSCALL_DEFINE” well over 850 and 500+ are even documented “man syscalls” FS layer has 223). Verified today vs Only about 100 POSIX API calls 513 syscalls with man pages! +12 just since last year’s SDC! Some examples of new fs ones from past 9 months ... Syscall name Kernel Version introduced io_uring_enter 5.1 io_uring_register 5.1 io_uring_setup 5.1 move_mount 5.2 open_tree 5.2 fsconfig 5.2 fsmount 5.2 fsopen 5.2 fspick 5.2 Repeating an old slide ... Remember LINUX > POSIX And not just new syscalls … new flags ... 2 examples of richer Linux vs. simpler POSIX fallocate has 7 flags – Insert range – Unshare range – Zero range – Keep size – But POSIX fallocate has no flags Rename (renameat2) has 3 flags – noreplace, whiteout and exchange – POSIX rename has none Network File systems matter ● these extensions to most popular network fs protocol (SMB3) are important ● block devices struggle to do file system tasks: locking, security, leases, consistent metadata Linux Apps need to work over network mounts and continue to work as Linux evolves Improve common situations where customers have Linux and Windows and Mac clients Make sure extensions work with most secure, most optimal SMB3.1.1 dialect (don’t encourage less secure network file systems, or even SMB1/CIFS) Quick Overview of Status ● Linux kernel client: – 5.1 kernel or later can be used.
    [Show full text]
  • Table of Contents 1
    Table Of Contents 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands G etting onto the Zoo Type “ssh <netid>@node.zoo.cs.yale.edu”, and enter your netID password when ​ ​ prompted. Your password won’t show up and the cursor won’t move, but it knows what you’re typing. G etting Files onto the Zoo Use the “scp” command to transfer files onto the Zoo. Type “scp filename1 filename2 ​ ​ ​ <netid>@node.zoo.cs.yale.edu:~/mydirectory/mysubdirectory” ​ You should be on your local machine in the same directory as the two files. This will copy the two local files, filename1 and filename2 into the directory mysubdirectory (which is ​ ​ ​ ​ ​ ​ located inside mydirectory in your home directory on the Zoo). You will be prompted to ​ ​ enter your netID password, just like when you ssh in. U nix Basics What is a directory? A directory is simply a folder, which can contain any mixture of files and ​ subdirectories. What is different about a file versus a directory? A directory contains other files and directories, ​ but does not contain information itself -- for example, you can’t use emacs to view a directory. However, you can often use a text editor to view the contents of a file. Sometimes directories and files have different colors when you look at what’s in your current directory, depending on your terminal settings, which can help you tell which is which. What about an executable? An executable is a special type of file that can be run by your ​ computer.
    [Show full text]
  • Management of Replicated Volume Location Data in the Ficus
    Appeared in the Proceedings of the Summer USENIX Conference, June 1991, pages 17-29 Management of Replicated Volume Lo cation Data in the Ficus Replicated File System y Thomas W. Page Jr., Richard G. Guy, John S. Heidemann, Gerald J. Popek, Wai Mak, and Dieter Rothmeier Department of Computer Science University of California Los Angeles fpage,guy,popek,johnh,waimak,[email protected] Abstract Existing techniques to provide name transparency in distributed le systems have b een de- signed for mo dest scale systems, and do not readily extend to very large con gurations. This pap er details the approach whichisnow op erational in the Ficus replicated Unix ling envi- ronment, and shows how it di ers from other metho ds currently in use. The Ficus mechanism p ermits optimistic management of the volume lo cation data by exploiting the existing directory reconciliation algorithms which merge directory up dates made during network partition. 1 Intro duction Most Unix le system implementations separate the maintenance of name binding data into two levels: within a volume or lesystem, directory entries bind names to low-level identi ers such as ino des; a second mechanism is used to form a sup er-tree by \gluing" the set of volumes to each other. The traditional Unix volume sup er-tree connection mechanism has b een widely altered or replaced to supp ort b oth small and large scale distributed le systems. Examples of the former are Sun's Network File System NFS [13] and IBM's TCF [12]; larger scale le systems are exempli ed by AFS [7], Decorum [6], Co da [14], Sprite [9], and Ficus [2, 10].
    [Show full text]
  • Oreilly Version Control with GIT.Pdf
    Version Control with Git Jon Loeliger Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo Version Control with Git by Jon Loeliger Copyright © 2009 Jon Loeliger. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or [email protected]. Editor: Andy Oram Indexer: Fred Brown Production Editor: Loranah Dimant Cover Designer: Karen Montgomery Proofreader: Katie Nopper DePasquale Interior Designer: David Futato Production Services: Newgen North America Illustrator: Robert Romano Printing History: May 2009: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Version Control with Git, the image of a long-eared bat, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein. ISBN: 978-0-596-52012-0 [M] 1242320486 Table of Contents Preface . xi 1.
    [Show full text]