Rob van der Woude's Scripting Pages

Help text for ReadLine.cs

(view help text of ReadLine.cs as plain text)

ReadLine,  Version 0.30 beta
Return the specified line(s) from a file or Standard Input

Usage:   READLINE  filename  [ options ]
   or:   READLINE  [ options ]  <  filename
   or:   command  |  READLINE  [ options ]

Where:   filename   is the optional file to be read
         command    is the optional command whose output is to be read

Options: /C         Concatenate lines
         /CS        Concatenate lines with Spaces in between
         /L:n       read line n
         /L:n..m    read lines n through m
         /L:n,m     read m lines starting at line n
                    (negative numbers start counting from the end backwards)
         /SE        Skip Empty lines
         /T         Trim leading and trailing whitespace from lines

Examples:
READLINE  file                        read the first non-empty line (default)
READLINE  file  /L:2  /SE             read the second non-empty line of file
READLINE  file  /L:5..7               read lines 5..7 of file
READLINE  file  /L:-1                 read the last line of file
READLINE  file  /L:-2..-1             read the last 2 lines of file
READLINE  file  /L:-2,2               read the last 2 lines of file

Check for redirection by Hans Passant on StackOverflow.com
/questions/3453220/how-to-detect-if-console-in-stdin-has-been-redirected

Written by Rob van der Woude
http://www.robvanderwoude.com

page last uploaded: 2017-03-25, 21:31