to-uppercase.rex

Pipelines v2.1

 

.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10...

Home

     **** Top of file ****
   1
   2 /* The following pipeline changes the first letter of each word in the file: winston.txt to uppercase
   3    and displays the records on the console.
   4
   5    The pipeline preserves leading, trailing and embedded whitespace, blank records (comprising spaces
   6    and tabs) and null records. The pipeline manipulates the records by inserting a number of placement
   7    characters: x'fd', x'fe' and x'ff' into the records to serve as markers that aid in splitting and
   8    joining the records. The pipeline assumes that these placement characters are not already present
   9    in the input file. */
  10
  11 Address Rxpipe
  12
  13 'pipe (endchar ?)',
  14      '< &installdrive:\&installpath\examples\input\winston.txt',
  15      '| a: locate',           /* Send null records to second pipeline. */
  16      '| b: faninany',         /* Read from both streams. */
  17      '| specs 1-* 1 xfe n',   /* Append a x'fe' to each record. */
  18      '| xlate x20 xff',       /* Change a space to x'ff'. */
  19      '| split after str xff', /* Separate a record into words/records at each x'ff' character. */
  20      '| xlate 1 upper',       /* Translate the first byte of each word/record to uppercase. */
  21      '| join until str xfe',  /* Concatenate records until the first byte of a record is x'fe'. */
  22      '| split at str xfe',    /* Split each record into multiple records at a x'fe' character. */
  23      '| change 1 xfd \\',     /* Remove the leading x'fd' character. */
  24      '| xlate xff x20',       /* Change x'ff' characters back to spaces. */
  25      '| cons',                /* Display on the console. */
  26      '?',
  27      'a:',
  28      '| specs xfd 1',         /* Replace a null record with a record containing a x'fd' character. */
  29      '| b:'
  30
  31 Say 'Hit Enter to close..'
  32 Parse Pull
  33
  34 Exit 0
     **** End of file ****
 

Console output

 
.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10...
   1
   2
   3
   4 It Was A Bright Cold Day In April, And The Clocks Were Striking Thirteen.
   5 Winston Smith, His Chin Nuzzled Into His Breast In An Effort To Escape The Vile
   6 Wind, Slipped Quickly Through The Glass Doors Of Victory Mansions, Though Not
   7 Quickly Enough To Prevent A Swirl Of Gritty Dust From Entering Along With Him.
   8
   9 The Hallway Smelt Of Boiled Cabbage And Old Rag Mats. At One End Of It A
  10 Coloured Poster, Too Large For Indoor Display, Has Been Tacked To The Wall. It
  11 Depicted Simply An Enormous Face, More Than A Metre Wide: The Face Of A Man
  12 About Forty-five, With A Heavy Black Moustache And Ruggedly Handsome Features.
  13 Winston Made For The Stairs.
  14
  15 It Was No Use Trying The Lift. Even At The Best Of Times It Was Seldom Working,
  16 And At Present The Electric Current Was Cut Off During Daylight Hours. It Was
  17 Part Of The Economy Drive In Preparation For Hate Week. The Flat Was Seven
  18 Flights Up, And Winston, Who Was Thirty-nine And Had A Varicose Ulcer Above His
  19 Right Ankle, Went Slowly, Resting Several Times On The Way. On Each Landing,
  20 Opposite The Lift Shaft, The Poster With The Enormous Face Gazed From The Wall.
  21 It Was One Of Those Pictures Which Are So Contrived That The Eyes Follow You
  22 About When You Move.
  23
  24 BIG BROTHER IS WATCHING YOU, The Caption Beneath It Ran.
  25
  26
  27
  28
  29 Hit Enter to close..