Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-18-2012
Registered User
 
Join Date: May 2012
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Is there a way to add padding to a bash shell script?

I'm grepping several lines and I want all of them to display with the same padding, is there a command to add whitespace before a line?
Sponsored Links
    #2  
Old 06-18-2012
Scrutinizer's Avatar
Moderator
 
Join Date: Nov 2008
Location: Amsterdam
Posts: 7,350
Thanks: 144
Thanked 1,755 Times in 1,592 Posts
have a look at
Code:
printf


Code:
$ printf "%15s\n" hello how are you?
          hello
            how
            are
           you?

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
zero padding problem (bash) jremio Shell Programming and Scripting 4 01-09-2012 10:21 PM
Bash Shell Script help123 Shell Programming and Scripting 6 11-14-2011 09:09 PM
bash padding ab52 Shell Programming and Scripting 3 07-25-2011 01:04 PM
Bash shell script- help sam101 Shell Programming and Scripting 1 01-26-2011 05:41 PM
bash typeset padding with zeros jwheeler Shell Programming and Scripting 2 07-08-2008 01:09 PM



All times are GMT -4. The time now is 11:55 AM.