- c list The list specifies character positions.

Size: px
Start display at page:

Download "- c list The list specifies character positions."

Transcription

1 CUT(1) BSD General Commands Manual CUT(1)... 1 PASTE(1) BSD General Commands Manual PASTE(1)... 3 UNIQ(1) BSD General Commands Manual UNIQ(1)... 5 HEAD(1) BSD General Commands Manual HEAD(1)... 7 TAIL(1) BSD General Commands Manual TAIL(1)... 8 TR(1) BSD General Commands Manual TR(1) CUT(1) BSD General Commands Manual CUT(1) NAME cut - cut out selected portions of each line of a file SYNOPSIS cut - b list [- n] [file...] cut - c list [file...] cut - f list [- d delim] [- s] [file...] DESCRIPTION The cut utility cuts out selected portions of each line (as specified by list) from each file and writes them to the standard output. If no file arguments are specified, or a file argument is a single dash (`- '), cut reads from the standard input. The items specified by list can be in terms of column position or in terms of fields delimited by a special character. Column numbering starts from 1. The list option argument is a comma or whitespace separated set of num- bers and/or number ranges. Number ranges consist of a number, a dash (`- '), and a second number and select the fields or columns from the first number to the second, inclusive. Numbers or number ranges may be preceded by a dash, which selects all fields or columns from 1 to the last number. Numbers or number ranges may be followed by a dash, which selects all fields or columns from the last number to the end of the line. Numbers and number ranges may be repeated, overlapping, and in any order. If a field or column is specified multiple times, it will appear only once in the output. It is not an error to select fields or columns not present in the input line. The options are as follows: - b list The list specifies byte positions. - c list The list specifies character positions. - d delim Use delim as the field delimiter character instead of the tab

2 character. - f list The list specifies fields, separated in the input by the field delimiter character (see the - dd option.) Output fields are sepa- rated by a single occurrence of the field delimiter character. - n - s Do not split multi- byte characters. Characters will only be out- put if at least one byte is selected, and, after a prefix of zero or more unselected bytes, the rest of the bytes that form the character are selected. Suppress lines with no field delimiter characters. Unless speci- fied, lines with no delimiters are passed through unmodified. ENVIRONMENT The LANG, LCALL and LCCTYPE environment variables affect the execution of cut as described in environ(7). EXIT STATUS The cut utility exits 0 on success, and >0 if an error occurs. EXAMPLES Extract users' login names and shells from the system passwd(5) file as ``name:shell'' pairs: cut - d : - f 1,7 /etc/passwd Show the names and login times of the currently logged in users: who cut - c 1-16,26-38 SEE ALSO colrm(1), paste(1) STANDARDS The cut utility conforms to IEEE Std (``POSIX.2''). HISTORY A cut command appeared in AT&T System III UNIX. BSD December 21, 2006 BSD

3 PASTE(1) BSD General Commands Manual PASTE(1) NAME paste - - merge corresponding or subsequent lines of files SYNOPSIS paste [- s] [- d list] file... DESCRIPTION The ppaassttee utility concatenates the corresponding lines of the given input files, replacing all but the last file's newline characters with a single tab character, and writes the resulting lines to standard output. If end- of- file is reached on an input file while other input files still contain data, the file is treated as if it were an endless source of empty lines. The options are as follows: - d list Use one or more of the provided characters to replace the newline characters instead of the default tab. The charac- ters in list are used circularly, i.e., when list is exhausted the first character from list is reused. This con- tinues until a line from the last input file (in default operation) or the last line in each file (using the - s option) is displayed, at which time ppaassttee begins selecting characters from the beginning of list again. The following special characters can also be used in list: \n newline character \t tab character \\ backslash character \0 Empty string (not a null character). Any other character preceded by a backslash is equivalent to the character itself. - s Concatenate all of the lines of each separate input file in command line order. The newline character of every line except the last line in each input file is replaced with the tab character, unless otherwise specified by the - - dd option. If `- ' is specified for one or more of the input files, the standard input is used; standard input is read one line at a time, circularly, for each instance of `- '. EXIT STATUS The paste utility exits 0 on success, and >0 if an error occurs.

4 EXAMPLES List the files in the current directory in three columns: ls paste Combine pairs of lines from a file into single lines: paste - s - d '\t\n' myfile Number the lines in a file, similar to nl(1): sed = myfile paste - s - d '\t\n' - - Create a colon- separated list of directories named bin, suitable for use in the PATH environment variable: find / - name bin - type d paste - s - d : - BSD June 25, 2004 BSD

5 UNIQ(1) BSD General Commands Manual UNIQ(1) NAME uniq - - report or filter out repeated lines in a file SYNOPSIS uniq [- c - d - u] [- i] [- f num] [- s chars] [inputfile [outputfile]] DESCRIPTION The uunniiqq utility reads the specified inputfile comparing adjacent lines, and writes a copy of each unique input line to the outputfile. If inputfile is a single dash (`- ') or absent, the standard input is read. If outputfile is absent, standard output is used for output. The second and succeeding copies of identical adjacent input lines are not written. Repeated lines in the input will not be detected if they are not adja- cent, so it may be necessary to sort the files first. The following options are available: - c - d Precede each output line with the count of the number of times the line occurred in the input, followed by a single space. Only output lines that are repeated in the input. - f num Ignore the first num fields in each input line when doing compar- isons. A field is a string of non- blank characters separated from adjacent fields by blanks. Field numbers are one based, i.e., the first field is field one. - s chars Ignore the first chars characters in each input line when doing comparisons. If specified in conjunction with the - - ff option, the first chars characters after the first num fields will be ignored. Character numbers are one based, i.e., the first char- acter is character one. - u - i Only output lines that are not repeated in the input. Case insensitive comparison of lines. ENVIRONMENT The LANG, LC_ALL, LCOLLATE and LC_CTYPE environment variables affect the execution of uniq as described in environ(7).

6 EXIT STATUS The uniq utility exits 0 on success, and >0 if an error occurs. BSD July 3, 2004 BSD

7 HEAD(1) BSD General Commands Manual HEAD(1) NAME head - - display first lines of a file SYNOPSIS head [- n count - c bytes] [file...] DESCRIPTION This filter displays the first count lines or bytes of each of the speci- fied files, or of the standard input if no files are specified. If count is omitted it defaults to 10. If more than a single file is specified, each file is preceded by a header consisting of the string ``==> XXX <=='' where ``XXX'' is the name of the file. EXIT STATUS The head utility exits 0 on success, and >0 if an error occurs. BSD June 6, 1993 BSD

8 File: *manpages*, Node: tail, Up: (dir) TAIL(1) BSD General Commands Manual TAIL(1) NAME tail - - display the last part of a file SYNOPSIS tail [- F - f - r] [- q] [- b number - c number - n number] [file...] DESCRIPTION The tail utility displays the contents of file or, by default, its stan- dard input, to the standard output. The display begins at a byte, line or 512- byte block location in the input. Numbers having a leading plus (`+') sign are relative to the beginning of the input, for example, ``- c +2'' starts the display at the second byte of the input. Numbers having a leading minus (`- ') sign or no explicit sign are relative to the end of the input, for example, ``- n 2'' displays the last two lines of the input. The default starting loca- tion is ``- n 10'', or the last 10 lines of the input. The options are as follows: - b number The location is number 512- byte blocks. - c number The location is number bytes. - f - F The - f option causes tail to not stop when end of file is reached, but rather to wait for additional data to be appended to the input. The - f option is ignored if the standard input is a pipe, but not if it is a FIFO. The - F option implies the - f option, but tail will also check to see if the file being followed has been renamed or rotated. The file is closed and reopened when tail detects that the filename being read from has a new inode number. The - F option is ignored if reading from standard input rather than a file. - n number The location is number lines. - q Suppresses printing of headers when multiple files are being examined.

9 - r The - r option causes the input to be displayed in reverse order, by line. Additionally, this option changes the meaning of the - b, - c and - n options. When the - r option is specified, these options specify the number of bytes, lines or 512- byte blocks to display, instead of the bytes, lines or blocks from the beginning or end of the input from which to begin the display. The default for the - r option is to display all of the input. If more than a single file is specified, each file is preceded by a header consisting of the string ``==> XXX <=='' where XXX is the name of the file unless - q flag is specified. EXIT STATUS The tail utility exits 0 on success, and >0 if an error occurs. SEE ALSO cat(1), head(1), sed(1) STANDARDS The tail utility is expected to be a superset of the IEEE Std (``POSIX.2'') specification. In particular, the - F, - b and - r options are extensions to that standard. The historic command line syntax of tail is supported by this implementa- tion. The only difference between this implementation and historic ver- sions of tail, once the command line syntax translation has been done, is that the - b, - c and - n options modify the - r option, i.e., ``- r - c 4'' displays the last 4 characters of the last line of the input, while the historic tail (using the historic syntax ``- 4cr'') would ignore the - c option and display the last 4 lines of the input. HISTORY A tail command appeared in PWB UNIX. BSD June 29, 2006 BSD

10 TR(1) BSD General Commands Manual TR(1) NAME tr - - translate characters SYNOPSIS tr [- Ccsu] string1 string2 tr [- Ccu] - - d string1 tr [- Ccu] - - s string1 tr [- Ccu] - - ds string1 string2 DESCRIPTION The tr utility copies the standard input to the standard output with sub- stitution or deletion of selected characters. The following options are available: - C - c - d - s - u Complement the set of characters in string1, that is ``- C ab'' includes every character except for `a' and `b'. Same as - C but complement the set of values in string1. Delete characters in string1 from the input. Squeeze multiple occurrences of the characters listed in the last operand (either string1 or string2) in the input into a single instance of the character. This occurs after all deletion and translation is completed. Guarantee that any output is unbuffered. In the first synopsis form, the characters in string1 are translated into the characters in string2 where the first character in string1 is trans- lated into the first character in string2 and so on. If string1 is longer than string2, the last character found in string2 is duplicated until string1 is exhausted. In the second synopsis form, the characters in string1 are deleted from the input. In the third synopsis form, the characters in string1 are compressed as described for the - s option. In the fourth synopsis form, the characters in string1 are deleted from the input, and the characters in string2 are compressed as described for the - s option. The following conventions can be used in string1 and string2 to specify sets of characters:

11 character Any character not described by one of the following conven- tions represents itself. \octal A backslash followed by 1, 2 or 3 octal digits represents a character with that encoded value. To follow an octal sequence with a digit as a character, left zero- pad the octal sequence to the full 3 octal digits. \character A backslash followed by certain special characters maps to special values. \a <alert character> \b <backspace> \f <form- feed> \n <newline> \r <carriage return> \t <tab> \v <vertical tab> A backslash followed by any other character maps to that char- acter. c- c For non- octal range endpoints represents the range of charac- ters between the range endpoints, inclusive, in ascending order, as defined by the collation sequence. If either or both of the range endpoints are octal sequences, it represents the range of specific coded values between the range end- points, inclusive. See the COMPATIBILITY section below for an important note regarding differences in the way the current implementation interprets range expressions differently from previous imple- mentations. [:class:] Represents all characters belonging to the defined character class. Class names are: alnum <alphanumeric characters> alpha <alphabetic characters> blank <whitespace characters> cntrl <control characters> digit <numeric characters> graph <graphic characters> ideogram <ideographic characters> lower <lower- case alphabetic characters> phonogram <phonographic characters> print <printable characters>

12 punct <punctuation characters> rune <valid characters> space <space characters> special <special characters> upper <upper- case characters> xdigit <hexadecimal characters> When ``[:lower:]'' appears in string1 and ``[:upper:]'' appears in the same relative position in string2, it repre- sents the characters pairs from the toupper mapping in the LCCTYPE category of the current locale. When ``[:upper:]'' appears in string1 and ``[:lower:]'' appears in the same rela- tive position in string2, it represents the characters pairs from the tolower mapping in the LCCTYPE category of the cur- rent locale. With the exception of case conversion, characters in the classes are in unspecified order. For specific information as to which ASCII characters are included in these classes, see ctype(3) and related manual pages. [=equiv=] Represents all characters belonging to the same equivalence class as equiv, ordered by their encoded values. [#*n] Represents n repeated occurrences of the character represented by #. This expression is only valid when it occurs in string2. If n is omitted or is zero, it is be interpreted as large enough to extend string2 sequence to the length of string1. If n has a leading zero, it is interpreted as an octal value, otherwise, it is interpreted as a decimal value. ENVIRONMENT The LANG, LCALL, LCCTYPE and LCCOLLATE environment variables affect the execution of ttrr as described in environ(7). EXIT STATUS The ttrr utility exits 0 on success, and >0 if an error occurs. EXAMPLES The following examples are shown as given to the shell: Create a list of the words in file1, one per line, where a word is taken to be a maximal string of letters. tr - cs "[:alpha:]" "\n" < file1 Translate the contents of file1 to upper- case.

13 tr "[:lower:]" "[:upper:]" < file1 (This should be preferred over the traditional UNIX idiom of ``tr a- z A- Z'', since it works correctly in all locales.) Strip out non- printable characters from file1. tr - cd "[:print:]" < file1 Remove diacritical marks from all accented variants of the letter `e': tr "[=e=]" "e" BSD July 23, 2004 BSD

14

File Commands. Objectives

File Commands. Objectives File Commands Chapter 2 SYS-ED/Computer Education Techniques, Inc. 2: 1 Objectives You will learn: Purpose and function of file commands. Interrelated usage of commands. SYS-ED/Computer Education Techniques,

More information

psed [-an] script [file...] psed [-an] [-e script] [-f script-file] [file...]

psed [-an] script [file...] psed [-an] [-e script] [-f script-file] [file...] NAME SYNOPSIS DESCRIPTION OPTIONS psed - a stream editor psed [-an] script [file...] psed [-an] [-e script] [-f script-file] [file...] s2p [-an] [-e script] [-f script-file] A stream editor reads the input

More information

Regular Expressions. Todd Kelley CST8207 Todd Kelley 1

Regular Expressions. Todd Kelley CST8207 Todd Kelley 1 Regular Expressions Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 POSIX character classes Some Regular Expression gotchas Regular Expression Resources Assignment 3 on Regular Expressions

More information

CS160A EXERCISES-FILTERS2 Boyd

CS160A EXERCISES-FILTERS2 Boyd Exercises-Filters2 In this exercise we will practice with the Unix filters cut, and tr. We will also practice using paste, even though, strictly speaking, it is not a filter. In addition, we will expand

More information

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs Summer 2010 Department of Computer Science and Engineering York University Toronto June 29, 2010 1 / 36 Table of contents 1 2 3 4 2 / 36 Our goal Our goal is to see how we can use Unix as a tool for developing

More information

User Commands sed ( 1 )

User Commands sed ( 1 ) NAME sed stream editor SYNOPSIS /usr/bin/sed [-n] script [file...] /usr/bin/sed [-n] [-e script]... [-f script_file]... [file...] /usr/xpg4/bin/sed [-n] script [file...] /usr/xpg4/bin/sed [-n] [-e script]...

More information

Linux Text Utilities 101 for S/390 Wizards SHARE Session 9220/5522

Linux Text Utilities 101 for S/390 Wizards SHARE Session 9220/5522 Linux Text Utilities 101 for S/390 Wizards SHARE Session 9220/5522 Scott D. Courtney Senior Engineer, Sine Nomine Associates March 7, 2002 http://www.sinenomine.net/ Table of Contents Concepts of the Linux

More information

Configuring the RADIUS Listener LEG

Configuring the RADIUS Listener LEG CHAPTER 16 Revised: July 28, 2009, Introduction This module describes the configuration procedure for the RADIUS Listener LEG. The RADIUS Listener LEG is configured using the SM configuration file p3sm.cfg,

More information

2) clear :- It clears the terminal screen. Syntax :- clear

2) clear :- It clears the terminal screen. Syntax :- clear 1) cal :- Displays a calendar Syntax:- cal [options] [ month ] [year] cal displays a simple calendar. If arguments are not specified, the current month is displayed. In addition to cal, the ncal command

More information

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT Unix as a Platform Exercises + Solutions Course Code: OS 01 UNXPLAT Working with Unix Most if not all of these will require some investigation in the man pages. That's the idea, to get them used to looking

More information

Part III. Shell Config. Tobias Neckel: Scripting with Bash and Python Compact Max-Planck, February 16-26,

Part III. Shell Config. Tobias Neckel: Scripting with Bash and Python Compact Max-Planck, February 16-26, Part III Shell Config Compact Course @ Max-Planck, February 16-26, 2015 33 Special Directories. current directory.. parent directory ~ own home directory ~user home directory of user ~- previous directory

More information

ISO/IEC JTC1/SC22/WG20 N

ISO/IEC JTC1/SC22/WG20 N Reference number of working document: ISO/IEC JTC1/SC22/WG20 N Date: 2001-12-25 Reference number of document: ISO/IEC DTR2 14652 Committee identification: ISO/IEC JTC1/SC22 Secretariat: ANSI Information

More information

Mineração de Dados Aplicada

Mineração de Dados Aplicada Simple but Powerful Text-Processing Commands August, 29 th 2018 DCC ICEx UFMG Unix philosophy Unix philosophy Doug McIlroy (inventor of Unix pipes). In A Quarter-Century of Unix (1994): Write programs

More information

More Scripting and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1

More Scripting and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1 More Scripting and Regular Expressions Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 Regular Expression Summary Regular Expression Examples Shell Scripting 2 Do not confuse filename globbing

More information

Basic Unix Command. It is used to see the manual of the various command. It helps in selecting the correct options

Basic Unix Command. It is used to see the manual of the various command. It helps in selecting the correct options Basic Unix Command The Unix command has the following common pattern command_name options argument(s) Here we are trying to give some of the basic unix command in Unix Information Related man It is used

More information

Reference number of working document: Reference number of document: ISO/IEC FCD

Reference number of working document: Reference number of document: ISO/IEC FCD Reference number of working document: ISO/IEC JTC1/SC22/WG20 N634 Date: 1998-12-21 Reference number of document: ISO/IEC FCD2 14652 Committee identification: ISO/IEC JTC1/SC22 Secretariat: ANSI Information

More information

lsx [ls_options ] [names]

lsx [ls_options ] [names] NAME ls, lc, l, ll, lsf, lsr, lsx - list contents of directories SYNOPSIS ls [-abcdefgilmnopqrstuxacfhlr1] [names] lc [-abcdefgilmnopqrstuxacfhlr1] [names] l [ls_options ] [names] ll [ls_options ] [names]

More information

Information technology. Specification method for cultural conventions ISO/IEC JTC1/SC22/WG20 N690. Reference number of working document:

Information technology. Specification method for cultural conventions ISO/IEC JTC1/SC22/WG20 N690. Reference number of working document: Reference number of working document: ISO/IEC JTC1/SC22/WG20 N690 Date: 1999-06-28 Reference number of document: ISO/IEC PDTR 14652 Committee identification: ISO/IEC JTC1/SC22 Secretariat: ANSI Information

More information

5/8/2012. Exploring Utilities Chapter 5

5/8/2012. Exploring Utilities Chapter 5 Exploring Utilities Chapter 5 Examining the contents of files. Working with the cut and paste feature. Formatting output with the column utility. Searching for lines containing a target string with grep.

More information

Module 8 Pipes, Redirection and REGEX

Module 8 Pipes, Redirection and REGEX Module 8 Pipes, Redirection and REGEX Exam Objective 3.2 Searching and Extracting Data from Files Objective Summary Piping and redirection Partial POSIX Command Line and Redirection Command Line Pipes

More information

TECHNICAL ISO/IEC REPORT TR 14652

TECHNICAL ISO/IEC REPORT TR 14652 TECHNICAL ISO/IEC REPORT TR 14652 Final text 2002-08-12 Information technology Specification method for cultural conventions Technologies de l information Méthode de modélisation des conventions culturelles

More information

Configuring the RADIUS Listener Login Event Generator

Configuring the RADIUS Listener Login Event Generator CHAPTER 19 Configuring the RADIUS Listener Login Event Generator Published: December 21, 2012 Introduction This chapter describes the configuration procedure for the RADIUS listener Login Event Generator

More information

Shell Programming Overview

Shell Programming Overview Overview Shell programming is a way of taking several command line instructions that you would use in a Unix command prompt and incorporating them into one program. There are many versions of Unix. Some

More information

UNIX, GNU/Linux and simple tools for data manipulation

UNIX, GNU/Linux and simple tools for data manipulation UNIX, GNU/Linux and simple tools for data manipulation Dr Jean-Baka DOMELEVO ENTFELLNER BecA-ILRI Hub Basic Bioinformatics Training Workshop @ILRI Addis Ababa Wednesday December 13 th 2017 Dr Jean-Baka

More information

Basics. I think that the later is better.

Basics.  I think that the later is better. Basics Before we take up shell scripting, let s review some of the basic features and syntax of the shell, specifically the major shells in the sh lineage. Command Editing If you like vi, put your shell

More information

Reading and manipulating files

Reading and manipulating files Reading and manipulating files Goals By the end of this lesson you will be able to Read files without using text editors Access specific parts of files Count the number of words and lines in a file Sort

More information

UNIX / LINUX - REGULAR EXPRESSIONS WITH SED

UNIX / LINUX - REGULAR EXPRESSIONS WITH SED UNIX / LINUX - REGULAR EXPRESSIONS WITH SED http://www.tutorialspoint.com/unix/unix-regular-expressions.htm Copyright tutorialspoint.com Advertisements In this chapter, we will discuss in detail about

More information

Advanced training. Linux components Command shell. LiLux a.s.b.l.

Advanced training. Linux components Command shell. LiLux a.s.b.l. Advanced training Linux components Command shell LiLux a.s.b.l. alexw@linux.lu Kernel Interface between devices and hardware Monolithic kernel Micro kernel Supports dynamics loading of modules Support

More information

Paolo Santinelli Sistemi e Reti. Regular expressions. Regular expressions aim to facilitate the solution of text manipulation problems

Paolo Santinelli Sistemi e Reti. Regular expressions. Regular expressions aim to facilitate the solution of text manipulation problems aim to facilitate the solution of text manipulation problems are symbolic notations used to identify patterns in text; are supported by many command line tools; are supported by most programming languages;

More information

C mini reference. 5 Binary numbers 12

C mini reference. 5 Binary numbers 12 C mini reference Contents 1 Input/Output: stdio.h 2 1.1 int printf ( const char * format,... );......................... 2 1.2 int scanf ( const char * format,... );.......................... 2 1.3 char

More information

Week Overview. Simple filter commands: head, tail, cut, sort, tr, wc grep utility stdin, stdout, stderr Redirection and piping /dev/null file

Week Overview. Simple filter commands: head, tail, cut, sort, tr, wc grep utility stdin, stdout, stderr Redirection and piping /dev/null file ULI101 Week 05 Week Overview Simple filter commands: head, tail, cut, sort, tr, wc grep utility stdin, stdout, stderr Redirection and piping /dev/null file head and tail commands These commands display

More information

Unix Introduction to UNIX

Unix Introduction to UNIX Unix Introduction to UNIX Get Started Introduction The UNIX operating system Set of programs that act as a link between the computer and the user. Developed in 1969 by a group of AT&T employees Various

More information

Utility Commands. Note. System Management Command Reference for Cisco NCS 6000 Series Routers 1

Utility Commands. Note. System Management Command Reference for Cisco NCS 6000 Series Routers 1 This module describes the utility commands for Cisco IOS XR software. Utility commands provide CLI equivalents to common UNIX commands. Note Keywords are entered using the displayed syntax, or with UNIX-equivalent

More information

CS Unix Tools. Fall 2010 Lecture 5. Hussam Abu-Libdeh based on slides by David Slater. September 17, 2010

CS Unix Tools. Fall 2010 Lecture 5. Hussam Abu-Libdeh based on slides by David Slater. September 17, 2010 Fall 2010 Lecture 5 Hussam Abu-Libdeh based on slides by David Slater September 17, 2010 Reasons to use Unix Reason #42 to use Unix: Wizardry Mastery of Unix makes you a wizard need proof? here is the

More information

sed, a stream editor version 4.2.1, 25 June 2009 by Ken Pizzini, Paolo Bonzini

sed, a stream editor version 4.2.1, 25 June 2009 by Ken Pizzini, Paolo Bonzini sed, a stream editor version 4.2.1, 25 June 2009 by Ken Pizzini, Paolo Bonzini Copyright c 1998, 1999 Free Software Foundation, Inc. This file documents version 4.2.1 of GNU sed, a stream editor. Copyright

More information

Regex, Sed, Awk. Arindam Fadikar. December 12, 2017

Regex, Sed, Awk. Arindam Fadikar. December 12, 2017 Regex, Sed, Awk Arindam Fadikar December 12, 2017 Why Regex Lots of text data. twitter data (social network data) government records web scrapping many more... Regex Regular Expressions or regex or regexp

More information

Bash Reference Manual Reference Documentation for Bash Edition 2.5b, for Bash Version 2.05b. July 2002

Bash Reference Manual Reference Documentation for Bash Edition 2.5b, for Bash Version 2.05b. July 2002 .tex Bash Reference Manual Reference Documentation for Bash Edition 2.5b, for Bash Version 2.05b. July 2002 Chet Ramey, Case Western Reserve University Brian Fox, Free Software Foundation Copyright c 1991-2002

More information

CS 4218 Software Testing and Debugging Ack: Tan Shin Hwei for project description formulation

CS 4218 Software Testing and Debugging Ack: Tan Shin Hwei for project description formulation CS 4218 Software Testing and Debugging Ack: Tan Shin Hwei for project description formulation The Project CS 4218 covers the concepts and practices of software testing and debugging. An important portion

More information

Text processing. Adam Belloum ESA 2014/2015. Material Prepared by Eelco Schatborn

Text processing. Adam Belloum ESA 2014/2015. Material Prepared by Eelco Schatborn Text processing Adam Belloum a.s.z.belloum@uva.nl ESA 2014/2015 Material Prepared by Eelco Schatborn What if you are asked to Remove duplicate lines from file(s) Count the frequency of words in a file(s)

More information

FSASIM: A Simulator for Finite-State Automata

FSASIM: A Simulator for Finite-State Automata FSASIM: A Simulator for Finite-State Automata P. N. Hilfinger Chapter 1: Overview 1 1 Overview The fsasim program reads in a description of a finite-state recognizer (either deterministic or non-deterministic),

More information

Linux & Shell Programming 2014

Linux & Shell Programming 2014 Practical No : 1 Enrollment No: Group : A Practical Problem Write a date command to display date in following format: (Consider current date as 4 th January 2014) 1. dd/mm/yy hh:mm:ss 2. Today's date is:

More information

More text file manipulation: sorting, cutting, pasting, joining, subsetting,

More text file manipulation: sorting, cutting, pasting, joining, subsetting, More text file manipulation: sorting, cutting, pasting, joining, subsetting, Laboratory of Genomics & Bioinformatics in Parasitology Department of Parasitology, ICB, USP Inverse cat Last week we learned

More information

QUESTION BANK ON UNIX & SHELL PROGRAMMING-502 (CORE PAPER-2)

QUESTION BANK ON UNIX & SHELL PROGRAMMING-502 (CORE PAPER-2) BANK ON & SHELL PROGRAMMING-502 (CORE PAPER-2) TOPIC 1: VI-EDITOR MARKS YEAR 1. Explain set command of vi editor 2 2011oct 2. Explain the modes of vi editor. 7 2013mar/ 2013 oct 3. Explain vi editor 5

More information

Common File System Commands

Common File System Commands Common File System Commands ls! List names of all files in current directory ls filenames! List only the named files ls -t! List in time order, most recent first ls -l! Long listing, more information.

More information

AWK - PRETTY PRINTING

AWK - PRETTY PRINTING AWK - PRETTY PRINTING http://www.tutorialspoint.com/awk/awk_pretty_printing.htm Copyright tutorialspoint.com So far we have used AWK's print and printf functions to display data on standard output. But

More information

User Commands ls ( 1 )

User Commands ls ( 1 ) NAME ls list contents of directory SYNOPSIS /usr/bin/ls [-aabccdffghillmnopqrrstux1@] [file...] /usr/xpg4/bin/ls [-aabccdffghillmnopqrrstux1@] [file...] DESCRIPTION For each file that is a directory, ls

More information

INTERNATIONAL ISO/IEC WD10 STANDARD. Information technology Specification methods for cultural conventions

INTERNATIONAL ISO/IEC WD10 STANDARD. Information technology Specification methods for cultural conventions INTERNATIONAL ISO/IEC 30112 WD10 STANDARD ISO/IEC 30112 WD10 2014-04-04 Information technology Specification methods for cultural conventions Technologies de l'information Méthodes de modélisation des

More information

CSE II-Sem)

CSE II-Sem) 1 2 a) Login to the system b) Use the appropriate command to determine your login shell c) Use the /etc/passwd file to verify the result of step b. d) Use the who command and redirect the result to a file

More information

CST Lab #5. Student Name: Student Number: Lab section:

CST Lab #5. Student Name: Student Number: Lab section: CST8177 - Lab #5 Student Name: Student Number: Lab section: Working with Regular Expressions (aka regex or RE) In-Lab Demo - List all the non-user accounts in /etc/passwd that use /sbin as their home directory.

More information

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT Unix as a Platform Exercises Course Code: OS-01-UNXPLAT Working with Unix 1. Use the on-line manual page to determine the option for cat, which causes nonprintable characters to be displayed. Run the command

More information

Introduction to Bash Programming. Dr. Xiaolan Zhang Spring 2013 Dept. of Computer & Information Sciences Fordham University

Introduction to Bash Programming. Dr. Xiaolan Zhang Spring 2013 Dept. of Computer & Information Sciences Fordham University Introduction to Bash Programming Dr. Xiaolan Zhang Spring 2013 Dept. of Computer & Information Sciences Fordham University 1 Outline Shell command line syntax Shell builtin commands Shell variables, arguments

More information

Bashed One Too Many Times. Features of the Bash Shell St. Louis Unix Users Group Jeff Muse, Jan 14, 2009

Bashed One Too Many Times. Features of the Bash Shell St. Louis Unix Users Group Jeff Muse, Jan 14, 2009 Bashed One Too Many Times Features of the Bash Shell St. Louis Unix Users Group Jeff Muse, Jan 14, 2009 What is a Shell? The shell interprets commands and executes them It provides you with an environment

More information

Operating Systems, Unix Files and Commands SEEM

Operating Systems, Unix Files and Commands SEEM Operating Systems, Unix Files and Commands SEEM 3460 1 Major Components of Operating Systems (OS) Process management Resource management CPU Memory Device File system Bootstrapping SEEM 3460 2 Programs

More information

User Commands find ( 1 )

User Commands find ( 1 ) NAME find find files SYNOPSIS /usr/bin/find path... expression /usr/xpg4/bin/find path... expression DESCRIPTION The find utility recursively descends the directory hierarchy for each path seeking files

More information

sottotitolo A.A. 2016/17 Federico Reghenzani, Alessandro Barenghi

sottotitolo A.A. 2016/17 Federico Reghenzani, Alessandro Barenghi Titolo presentazione Piattaforme Software per la Rete sottotitolo BASH Scripting Milano, XX mese 20XX A.A. 2016/17, Alessandro Barenghi Outline 1) Introduction to BASH 2) Helper commands 3) Control Flow

More information

CS214-AdvancedUNIX. Lecture 2 Basic commands and regular expressions. Ymir Vigfusson. CS214 p.1

CS214-AdvancedUNIX. Lecture 2 Basic commands and regular expressions. Ymir Vigfusson. CS214 p.1 CS214-AdvancedUNIX Lecture 2 Basic commands and regular expressions Ymir Vigfusson CS214 p.1 Shellexpansions Let us first consider regular expressions that arise when using the shell (shell expansions).

More information

CSE2031. Lab 2 FALL 2009

CSE2031. Lab 2 FALL 2009 CSE2031 Lab 2 FALL 2009 In this lab, you will be introduced to more complex Unix commands. After this lab, you should be comfortable using Unix/Linux in the lab and as a platform for software development.

More information

More Scripting and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1

More Scripting and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1 More Scripting and Regular Expressions Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 lynda.com stty (pending from last week).bashrc versus.bash_profile More shell scripting Regular Expression

More information

Lecture 5. Essential skills for bioinformatics: Unix/Linux

Lecture 5. Essential skills for bioinformatics: Unix/Linux Lecture 5 Essential skills for bioinformatics: Unix/Linux UNIX DATA TOOLS Text processing with awk We have illustrated two ways awk can come in handy: Filtering data using rules that can combine regular

More information

A Brief Introduction to the Linux Shell for Data Science

A Brief Introduction to the Linux Shell for Data Science A Brief Introduction to the Linux Shell for Data Science Aris Anagnostopoulos 1 Introduction Here we will see a brief introduction of the Linux command line or shell as it is called. Linux is a Unix-like

More information

Gabriel Hugh Elkaim Spring CMPE 013/L: C Programming. CMPE 013/L: C Programming

Gabriel Hugh Elkaim Spring CMPE 013/L: C Programming. CMPE 013/L: C Programming 1 Literal Constants Definition A literal or a literal constant is a value, such as a number, character or string, which may be assigned to a variable or a constant. It may also be used directly as a function

More information

Utilities. September 8, 2015

Utilities. September 8, 2015 Utilities September 8, 2015 Useful ideas Listing files and display text and binary files Copy, move, and remove files Search, sort, print, compare files Using pipes Compression and archiving Your fellow

More information

Chapter 4: Computer Codes. In this chapter you will learn about:

Chapter 4: Computer Codes. In this chapter you will learn about: Ref. Page Slide 1/30 Learning Objectives In this chapter you will learn about: Computer data Computer codes: representation of data in binary Most commonly used computer codes Collating sequence Ref. Page

More information

5/8/2012. Encryption-based Protection. Protection based on Access Permission (Contd) File Security, Setting and Using Permissions Chapter 9

5/8/2012. Encryption-based Protection. Protection based on Access Permission (Contd) File Security, Setting and Using Permissions Chapter 9 File Security, Setting and Using Permissions Chapter 9 To show the three protection and security mechanisms that UNIX provides To describe the types of users of a UNIX file To discuss the basic operations

More information

Contents. Volume 1 Base Definitions, Issue

Contents. Volume 1 Base Definitions, Issue Volume 1 Base Definitions, Issue 7... 1 Chapter 1 Introduction... 3 1.1 Scope... 3 1.2 Conformance... 4 1.3 Normative References... 4 1.4 Change History... 5 1.5 Terminology... 5 1.6 Definitions and Concepts...

More information

STREAM EDITOR - REGULAR EXPRESSIONS

STREAM EDITOR - REGULAR EXPRESSIONS STREAM EDITOR - REGULAR EXPRESSIONS http://www.tutorialspoint.com/sed/sed_regular_expressions.htm Copyright tutorialspoint.com It is the regular expressions that make SED powerful and efficient. A number

More information

68000 Assembler by Paul McKee. User's Manual

68000 Assembler by Paul McKee. User's Manual Contents 68000 Assembler by Paul McKee User's Manual 1 Introduction 2 2 Source Code Format 2 2.1 Source Line Format............................... 2 2.1.1 Label Field............................... 2 2.1.2

More information

Shells and Shell Programming

Shells and Shell Programming Shells and Shell Programming 1 Shells A shell is a command line interpreter that is the interface between the user and the OS. The shell: analyzes each command determines what actions are to be performed

More information

Muntaser Abulafi Yacoub Sabatin Omar Qaraeen. C Data Types

Muntaser Abulafi Yacoub Sabatin Omar Qaraeen. C Data Types Programming Fundamentals for Engineers 0702113 5. Basic Data Types Muntaser Abulafi Yacoub Sabatin Omar Qaraeen 1 2 C Data Types Variable definition C has a concept of 'data types' which are used to define

More information

5/20/2007. Touring Essential Programs

5/20/2007. Touring Essential Programs Touring Essential Programs Employing fundamental utilities. Managing input and output. Using special characters in the command-line. Managing user environment. Surveying elements of a functioning system.

More information

Overview. Unix/Regex Lab. 1. Setup & Unix review. 2. Count words in a text. 3. Sort a list of words in various ways. 4.

Overview. Unix/Regex Lab. 1. Setup & Unix review. 2. Count words in a text. 3. Sort a list of words in various ways. 4. Overview Unix/Regex Lab CS 341: Natural Language Processing Heather Pon-Barry 1. Setup & Unix review 2. Count words in a text 3. Sort a list of words in various ways 4. Search with grep Based on Unix For

More information

Chapter 4. Unix Tutorial. Unix Shell

Chapter 4. Unix Tutorial. Unix Shell Chapter 4 Unix Tutorial Users and applications interact with hardware through an operating system (OS). Unix is a very basic operating system in that it has just the essentials. Many operating systems,

More information

Shells and Shell Programming

Shells and Shell Programming Shells and Shell Programming Shells A shell is a command line interpreter that is the interface between the user and the OS. The shell: analyzes each command determines what actions are to be performed

More information

Control Flow Statements. Execute all the statements grouped in the brackets. Execute statement with variable set to each subscript in array in turn

Control Flow Statements. Execute all the statements grouped in the brackets. Execute statement with variable set to each subscript in array in turn Command Short Description awk cmds file(s) Invokes the awk commands (cmds) on the file or files (file(s)) $1 $2 $3... Denotes the first, second, third, and so on fields respectively in a file $0 Denotes

More information

Bash scripting Tutorial. Hello World Bash Shell Script. Super User Programming & Scripting 22 March 2013

Bash scripting Tutorial. Hello World Bash Shell Script. Super User Programming & Scripting 22 March 2013 Bash scripting Tutorial Super User Programming & Scripting 22 March 2013 Hello World Bash Shell Script First you need to find out where is your bash interpreter located. Enter the following into your command

More information

CS Advanced Unix Tools & Scripting

CS Advanced Unix Tools & Scripting & Scripting Spring 2011 Hussam Abu-Libdeh Today s slides are from David Slater February 25, 2011 Hussam Abu-Libdeh Today s slides are from David Slater & Scripting Random Bash Tip of the Day The more you

More information

bash, part 3 Chris GauthierDickey

bash, part 3 Chris GauthierDickey bash, part 3 Chris GauthierDickey More redirection As you know, by default we have 3 standard streams: input, output, error How do we redirect more than one stream? This requires an introduction to file

More information

Shells & Shell Programming (Part B)

Shells & Shell Programming (Part B) Shells & Shell Programming (Part B) Software Tools EECS2031 Winter 2018 Manos Papagelis Thanks to Karen Reid and Alan J Rosenthal for material in these slides CONTROL STATEMENTS 2 Control Statements Conditional

More information

VHDL Lexical Elements

VHDL Lexical Elements 1 Design File = Sequence of Lexical Elements && Separators (a) Separators: Any # of Separators Allowed Between Lexical Elements 1. Space character 2. Tab 3. Line Feed / Carriage Return (EOL) (b) Lexical

More information

Lexical Considerations

Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2005 Handout 6 Decaf Language Wednesday, September 7 The project for the course is to write a

More information

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc.

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc. Appendix A GLOSSARY SYS-ED/ Computer Education Techniques, Inc. $# Number of arguments passed to a script. $@ Holds the arguments; unlike $* it has the capability for separating the arguments. $* Holds

More information

LESSON 4. The DATA TYPE char

LESSON 4. The DATA TYPE char LESSON 4 This lesson introduces some of the basic ideas involved in character processing. The lesson discusses how characters are stored and manipulated by the C language, how characters can be treated

More information

User Commands tar ( 1 )

User Commands tar ( 1 ) NAME tar create tape archives and add or extract files SYNOPSIS tar c [ bbeeffhiklnoppqvwx@ [0-7]] [block] [tarfile] [exclude-file] {-I include-file -C directory file file}... tar r [ bbeeffhiklnqvw@ [0-7]]

More information

Computers Programming Course 5. Iulian Năstac

Computers Programming Course 5. Iulian Năstac Computers Programming Course 5 Iulian Năstac Recap from previous course Classification of the programming languages High level (Ada, Pascal, Fortran, etc.) programming languages with strong abstraction

More information

Fundamentals of Programming. Lecture 11: C Characters and Strings

Fundamentals of Programming. Lecture 11: C Characters and Strings 1 Fundamentals of Programming Lecture 11: C Characters and Strings Instructor: Fatemeh Zamani f_zamani@ce.sharif.edu Sharif University of Technology Computer Engineering Department The lectures of this

More information

Regular Expressions. Michael Wrzaczek Dept of Biosciences, Plant Biology Viikki Plant Science Centre (ViPS) University of Helsinki, Finland

Regular Expressions. Michael Wrzaczek Dept of Biosciences, Plant Biology Viikki Plant Science Centre (ViPS) University of Helsinki, Finland Regular Expressions Michael Wrzaczek Dept of Biosciences, Plant Biology Viikki Plant Science Centre (ViPS) University of Helsinki, Finland November 11 th, 2015 Regular expressions provide a flexible way

More information

Information technology Portable Operating System Interface (POSIX ) Part 3: Shell and Utilities

Information technology Portable Operating System Interface (POSIX ) Part 3: Shell and Utilities INTERNATIONAL STANDARD ISO/IEC 9945-3:2003 TECHNICAL CORRIGENDUM 1 Published 2004-09-15 INTERNATIONAL ORGANIZATION FOR STANDARDIZATION МЕЖДУНАРОДНАЯ ОРГАНИЗАЦИЯ ПО СТАНДАРТИЗАЦИИ ORGANISATION INTERNATIONALE

More information

http://xkcd.com/208/ 1. Review of pipes 2. Regular expressions 3. sed 4. Editing Files 5. Shell loops 6. Shell scripts cat seqs.fa >0! TGCAGGTATATCTATTAGCAGGTTTAATTTTGCCTGCACTTGGTTGGGTACATTATTTTAAGTGTATTTGACAAG!

More information

The input can also be taken from a file and similarly the output can be redirected to another file.

The input can also be taken from a file and similarly the output can be redirected to another file. Filter A filter is defined as a special program, which takes input from standard input device and sends output to standard output device. The input can also be taken from a file and similarly the output

More information

CPSC 217 Midterm (Python 3 version)

CPSC 217 Midterm (Python 3 version) CPSC 217 Midterm (Python 3 version) Duration: 50 minutes 6 March 2009 This exam has 61 questions and 11 pages. This exam is closed book. No notes, books, calculators or electronic devices, or other assistance

More information

1 Lexical Considerations

1 Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler

More information

Skip the first SKIP1 bytes of FILE1 and the first SKIP2 bytes of FILE2. l verbose Output byte numbers and values of all differing bytes.

Skip the first SKIP1 bytes of FILE1 and the first SKIP2 bytes of FILE2. l verbose Output byte numbers and values of all differing bytes. CMP(1) User Commands CMP(1) NAME cmp compare two files byte by byte SYNOPSIS cmp [OPTION]... FILE1 [FILE2 [SKIP1 [SKIP2]]] DESCRIPTION Compare two files byte by byte. b print bytes Print differing bytes.

More information

Regular Expressions. Regular expressions are a powerful search-and-replace technique that is widely used in other environments (such as Unix and Perl)

Regular Expressions. Regular expressions are a powerful search-and-replace technique that is widely used in other environments (such as Unix and Perl) Regular Expressions Regular expressions are a powerful search-and-replace technique that is widely used in other environments (such as Unix and Perl) JavaScript started supporting regular expressions in

More information

ITST Searching, Extracting & Archiving Data

ITST Searching, Extracting & Archiving Data ITST 1136 - Searching, Extracting & Archiving Data Name: Step 1 Sign into a Pi UN = pi PW = raspberry Step 2 - Grep - One of the most useful and versatile commands in a Linux terminal environment is the

More information

UNIX files searching, and other interrogation techniques

UNIX files searching, and other interrogation techniques UNIX files searching, and other interrogation techniques Ways to examine the contents of files. How to find files when you don't know how their exact location. Ways of searching files for text patterns.

More information

VI Commands Cheat Sheets

VI Commands Cheat Sheets VI Commands Cheat Sheets Before doing anything to a document, type the following command followed by a carriage return: :set showmode GOOD PRACTICE NOTE ESPECIALLY FOR BEGINNERS: WHEN USING VI, HIT [ESC]

More information

Unix/Linux Primer. Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois

Unix/Linux Primer. Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois Unix/Linux Primer Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois August 25, 2017 This primer is designed to introduce basic UNIX/Linux concepts and commands. No

More information

MULTIPLE CHOICE. Chapter Seven

MULTIPLE CHOICE. Chapter Seven Chapter Seven MULTIPLE CHOICE 1. Which of these is associated with a specific file and provides a way for the program to work with that file? a. Filename b. Extension c. File object d. File variable 2.

More information

VARIABLES AND CONSTANTS

VARIABLES AND CONSTANTS UNIT 3 Structure VARIABLES AND CONSTANTS Variables and Constants 3.0 Introduction 3.1 Objectives 3.2 Character Set 3.3 Identifiers and Keywords 3.3.1 Rules for Forming Identifiers 3.3.2 Keywords 3.4 Data

More information