10 More Discussions You Might Find Interesting
1. Programming
Hi,
Struggling with single quotes, double quotes, etc.
I want to print a header line, followed by lines with actual values, based on a print option.
In real life it is going to be something like 15 print options and 50 values.
Output will be 1 header and several value lines.
In this example... (5 Replies)
Discussion started by: ejdv
5 Replies
2. Shell Programming and Scripting
Hi guys,
could someone throw some light on the following behaviour of printf (I'll start with info about the system and the tool/shell/interpreter versions)?:
$ uname -a
Linux linux-86if.site 3.1.0-1.2-desktop #1 SMP PREEMPT Thu Nov 3 14:45:45 UTC 2011 (187dde0) x86_64 x86_64 x86_64... (9 Replies)
Discussion started by: elixir_sinari
9 Replies
3. Shell Programming and Scripting
i have written small script as follows:
name="hi hello"
printf "%-20s" $name
This gives me strange output. -20s format is applied on both word of string. i.e it displays both word hi and hello in space of 20 length.
I want to display entire string "hi hello" in length of 20 space.
plz... (2 Replies)
Discussion started by: admc123
2 Replies
4. Shell Programming and Scripting
In one of the scripts I am using pintf function as following
printf "%s%s%s\n" "$f1" "$f2" "$f3"
f3 variable contains a string of 10 characters. However it has value first 7 character and last 3 characters are empty.
Example
Aaaaaaa<3 spaces>
bbbbbbb<3 spaces>
ccccccc<3 spaces>... (4 Replies)
Discussion started by: varunrbs
4 Replies
5. Shell Programming and Scripting
I am having a major problem with printf, The more I pad it, the less I see :(
The problem is in the first function, report
Am I ruining output somewhere? I wont print out the names propely, it cuts them off or deletes them completely :(
#!/bin/bash
report()
{
printf "%-10s" STUD# ... (2 Replies)
Discussion started by: L0ckz0r
2 Replies
6. Shell Programming and Scripting
I would like to assign the output of printf to a variable in perl , it give me back a "1" instead of the time. How can I stuff the variable with what printf returns?
Here is my code:
#!/usr/bin/perl
$time = localtime(time);... (3 Replies)
Discussion started by: Dabheeruz
3 Replies
7. Shell Programming and Scripting
Hi,
I've got a basic problem using printf statement in awk.
I want to write float values with always 8 characters width.
Examples :
1.345678
12.45678
123.4567
1234.678
-23.5678
-2.45678
-23456.8
.....
I cannot find the right printf format %8.1f, %7.5f....
Can anyone help ?... (4 Replies)
Discussion started by: cazhot
4 Replies
8. Shell Programming and Scripting
I have the following code:
$ awk '{ printf "%-10s %s\n", $1, $2, $3, $4, $5, $5, $6 }' file
i can only print the first 2 elements ($1,$2). How can i print all the elements to appear like this:
aardvark 5555553 jhfjhfjkg efiigig ejkfjkej wjkdjk
alpo-net 5553412 ... (2 Replies)
Discussion started by: DDoS
2 Replies
9. UNIX for Advanced & Expert Users
Hi Friends,
Can anyone guide me how to compute sum of column4 from the below file x using awk command? when i do using awk I'm getting sum 7482350198352648.000000 which is not accurate.
$ cat x
56,232,dfgjkhdfj,,56,anand
56,22,dfgjkhdfj,7482347823453123.97834 ,56,Khan
56,23,dfgjkhdfj, ... (6 Replies)
Discussion started by: krishna
6 Replies
10. Programming
hello everybody,
here is my problem:
________________________________________
#include <stdio.h>
int main()
{
int i=10;
printf("value is %i",i);
return 0;
}
_________________________________________
when i compile and execute, nothing appears on screen!!
but if i replace the printf... (2 Replies)
Discussion started by: brain_processin
2 Replies