The shell builtin command that formats and prints data. Questions that deal with printf command or broadly using printf syntax by programming language (like awk, PHP, perl, C++...)

learn more… | top users | synonyms

0
votes
2answers
60 views

format command output with variable and fixed space

How can I achieve this best maintaining the hierarchy on the left and aligning the size value on the right? Also, at the same time I'd like to round the size to one or two digits. I tried with printf ...
0
votes
2answers
334 views

How to printf an exclamation point in tcsh?

What's the best way to printf an exclamation point in tcsh? It seems like using single or double quotes has no effect on escaping the exclamation point; and using a backspace does work, but then it ...
0
votes
1answer
52 views

Need help understanding this cpu utilization script

Need help in understanding the below Script : HEADER='CPU pctUser pctNice pctSystem pctIowait pctIdle' HEADERIZE="BEGIN {print \"$HEADER\"}" PRINTF='{printf "%-3s %9s %9s %9s %9s ...
3
votes
0answers
93 views

find printf switch POSIX alternative

I'd like to rewrite these 2 command so they will use only POSIX-complaint switches: find "$TARGET_DIR" -maxdepth 1 -type d -printf '(DIR) %f\n' find "$TARGET_DIR" -maxdepth 1 -type f -printf '%s %f ...
3
votes
0answers
325 views

How to create a bash command which creates output that exactly mimics a source text file that can be pasted into bash shell where histexpand is on?

The goal is to create a bash one line command that can be copied and pasted - for instance published on a web forum - and then patches files. See it as a way to distribute a patch file by copy and ...
0
votes
0answers
10 views

running command in Mobax Terminal are there plugins that are needed

while read CTFlist; do #next we need to create ctfs padded with zeros as a variable ctfPadded=$(printf ${ctflist}00000000) #then call rc2 key as variable rc2Key="TemporaryRC2Key1" #next create a ...
0
votes
0answers
31 views

Include text from other file in screen printf

The original code of main.sh: screen -S myscreenname -p 0 -X stuff "`printf "myabcdefg"`" I want to put only abcdefg (without my) in other file. Below codes works just fine but I need the text.txt ...
0
votes
0answers
51 views

Logging to a file in tabular format

I am trying to print something into a file through the script which will be sent as an attachment to the mail. Now what i am willing is to preserve a proper formatting within the file. Can i print ...