0

I have a below table

1  Data  2021-02-04
2  Data Two  2021-02-05

If I column -t -s '' I get

1  Data  2021-02-04
2  Data Two  2021-02-05

Any way I can format this as:

1  Data      2021-02-04
2  Data Two  2021-02-05

Or format by column number 3

4
  • What separates the columns? Tabs? Commented May 3, 2021 at 5:34
  • Double spaces between columns. Single space between the text in same column. Commented May 3, 2021 at 5:35
  • But your original table only has one space between Data Two and the date? Commented May 3, 2021 at 5:41
  • Let me re-edit, looks like funky ctrl+v Commented May 3, 2021 at 5:44

1 Answer 1

1

You have to first convert the two spaces separating columns in the original into a single character before feeding it to column. Something like:

$ sed 's/  /|/g' input.txt | column -t -s '|'  
1  Data      2021-02-04
2  Data Two  2021-02-05

Use a different character that doesn't appear in the input if | is present in it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.