Skip to main content
edited title
Link
JJoao
  • 12.8k
  • 1
  • 26
  • 45

Padding trailing whitespaces in a string with another charachtercharacter

edited title
Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 117

Writing Padding trailing whitespaces in a string over 20 characters maximum and complete white spaces with dotsanother charachter

I'd like to output hello worldhello world over 20 characters.

printf "%-20s :\n\n" 'hello world!!'

# Actual output
hello world!!        :

# Wanted output
hello world!!========:

However, I don't want to complete with spaces but with "=" instead. How do I do that?

Writing a string over 20 characters maximum and complete white spaces with dots

I'd like to output hello world over 20 characters

printf "%-20s :\n\n" 'hello world!!'

# Actual output
hello world!!        :

# Wanted output
hello world!!========:

However, I don't want to complete with spaces but with "=" instead. How do I do that?

Padding trailing whitespaces in a string with another charachter

I'd like to output hello world over 20 characters.

printf "%-20s :\n\n" 'hello world!!'

# Actual output
hello world!!        :

# Wanted output
hello world!!========:

However, I don't want to complete with spaces but with "=" instead. How do I do that?

Tweeted twitter.com/StackUnix/status/920666024613175298
added 44 characters in body
Source Link
smarber
  • 1.3k
  • 3
  • 14
  • 25

I'd like to output hello world over 20 characters

printf "%-20s :\n\n" 'hello world!!' 

# Actual output
hello world!!        :

# Wanted output
hello world!!========:

However, I don't want to complete with spaces but with "=" instead. How do I do that?

I'd like to output hello world over 20 characters

printf "%-20s :\n\n" 'hello world!!'

However, I don't want to complete with spaces but with "=" instead. How do I do that?

I'd like to output hello world over 20 characters

printf "%-20s :\n\n" 'hello world!!' 

# Actual output
hello world!!        :

# Wanted output
hello world!!========:

However, I don't want to complete with spaces but with "=" instead. How do I do that?

Source Link
smarber
  • 1.3k
  • 3
  • 14
  • 25
Loading