4
votes
1answer
54 views

One liner for padding columns (similar to printf) of output from the previous pipe command?

I'd normally use printf to pad each cell with enough whitespace to maintain header position over its respective column. I'm wondering now, whether there's a way to do this on one line. I'm currently ...
3
votes
2answers
379 views

Why does Bash history not record this command?

The command printf "#!/bin/bash\n" > t generates an error(bash: !/bin/bash\n": event not found), but hitting the up key does not recall the command so that I can modify it. Why is that? (What I ...
2
votes
2answers
239 views

Where can I find some good documentation for bash printf?

man printf, info printf and printf --help are all pretty useless to me; I want an explanation of the FORMAT options. For example, I could use: printf '%s\n' foo bar and get output: foo bar From ...
1
vote
1answer
185 views

Why does printf ignore the IFS when printing out the result of my script?

This is a follow up to a question posted on SO. I've written a script called except which should print all filenames / directories except the ones given like so. $ ls a b c d $ rm $(except b d) $ ls ...
2
votes
3answers
2k views

print output to 3 separate columns

MYPATH=/var/www/html/error_logs/ TOTALFILE=$(ls $MYPATH* | wc -l) FILETIME=$(stat --format=%y $MYPATH* | head -5 | cut -d'.' -f1) FILE=$(ls -1tcr $MYPATH* | head -5 | rev | cut -d/ -f1 | rev) ...