Align columns: Difference between revisions
Content added Content deleted
(Added C#) |
(→{{header|UNIX Shell}}: Add column(1)-based implementation) |
||
Line 8,113: | Line 8,113: | ||
The centered output will be added later, when I've more time. '' I did this in about 10 minutes.'' |
The centered output will be added later, when I've more time. '' I did this in about 10 minutes.'' |
||
=== Using <tt>column(1)</tt> === |
|||
Note that the left-justified case can be handled trivially by the <tt>column</tt> command, which ships with modern Linux and macOS systems: |
|||
<lang sh>tr '$' ' ' | column -t</lang> |
|||
{{Out}} |
|||
<pre>Given a text file of many lines, where fields within a line |
|||
are delineated by a single 'dollar' character, write a program |
|||
that aligns each column of fields by ensuring that words in each |
|||
column are separated by at least one space. |
|||
Further, allow for each word in a column to be either left |
|||
justified, right justified, or center justified within its column.</pre> |
|||
=={{header|Ursala}}== |
=={{header|Ursala}}== |