Hi!

unexpand describes spaces in the input in these places:
  NAME                   unexpand - convert spaces to tabs
  OPTIONS/-t/para 3      No <space>-to- <tab> conversions shall occur
  for characters at positions beyond the last of those specified in a
  multiple tab-stop list.
  ENVIRONMENT VARIABLES  the processing of <tab> and <space> characters
  STDOUT                 The standard output shall be equivalent to the
  input files with the specified <space>-to- <tab> conversions.
informative:
  APPLICATION USAGE      One non-intuitive aspect of unexpand is its
  restriction to leading <space> characters when neither -a nor -t is
  specified. Users who always want to convert all <space> characters in
  a file can easily alias unexpand to use the -a or -t 8 option.

And blanks in the input in these:
  DESCRIPTION           converting <blank> characters at the beginning
  of each line into the maximum number of <tab> characters followed by
  the minimum number of <space> characters needed to fill the same
  column positions originally filled by the translated <blank>
  characters
  OPTIONS/-a            In addition to translating <blank>  characters
  at the beginning of each line, translate all sequences of two or more
  <blank> characters immediately preceding a tab stop to the maximum
  number of <tab> characters followed by the minimum number of <space>
  characters needed to fill the same column positions originally
  filled by the translated <blank> characters.
  OPTIONS/-t/para 4     conversion shall not be limited to the
  processing of leading <blank> characters
informative:
  RATIONALE             The historical intent of unexpand was to
  translate multiple <blank> characters into tab stops, 

In short: OPTIONS/-a says <blank>s need to be translated, but STDOUT
forbids any transformations not from spaces.

The question therefore becomes: which interpretation is right?
Given printf '\uFEFF \ta\n \ta\n\t         a' | unexpand, is the output
'\ta\n\ta\n\t\t a'? '\uFEFF\ta\ta\n\t\t a'?
'\uFEFF \ta\n \ta\n\t         a'? Something else?

Applies to
  https://pubs.opengroup.org/onlinepubs/9699919799/utilities/unexpand.html
and the 202x-d2.1 draft.

Best,
наб

Attachment: signature.asc
Description: PGP signature

  • unexpand/OPTIONS/-t, STDO... наб via austin-group-l at The Open Group

Reply via email to