10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
printf "%5.5\n" "1234567890"
will print 12345 . How do I get it to print
67890
Essentially, I just want the last 5 characters rather than the first 5. (4 Replies)
Discussion started by: lavender
4 Replies
2. UNIX for Dummies Questions & Answers
I am playing with function fork() (creating few processes)and trying to put some output (with process id,child id and so on) to the shell and sometimes i get output for 2 proccesses mixed up on same line. sometimes I would get something like this...
myShell$ ./a.out
proccess1 ... (2 Replies)
Discussion started by: joker40
2 Replies
3. UNIX for Dummies Questions & Answers
For a variety of strange reasons, I've set up an arrangement by which a server responds with "Hi there" if I connect on a specified port. This is a typical transaction:
# telnet example.com 3334
Trying 123.456.789.101...
Connected to example.com.
Escape character is '^]'.
Hi there... (4 Replies)
Discussion started by: treesloth
4 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. UNIX for Dummies Questions & Answers
I have this command like that has %s in it, I know %s calls a column, but I am not sure I understand which column (I mean for my case I can check the input file, but I want to know how is this %s used, how comes tha same symbo; gives different columns in one command line:
{printf "grep %s... (22 Replies)
Discussion started by: cosmologist
22 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I have just completed my first script (:D) and now i just need to format it with printf.
This is what I have:
#!/bin/ksh
TOTB=0
TOTF=0
TOTI=0
HOST=`hostname`
echo " FSYSTEM BLKS FREE INUSE MOUNTEDON"
df -m | grep -v ":"|grep -v Free|grep -v "/proc"| while read FSYSTEM... (2 Replies)
Discussion started by: compan023
2 Replies
8. Shell Programming and Scripting
How to print output in following format?
A..................ok
AA................ok
AAA..............ok
AAAAAA........ok
"ok" one under one (4 Replies)
Discussion started by: mirusnet
4 Replies
9. Programming
What is the output of the following program considering an x86 based parameter passing sequence where stack grows towards lower memory addresses and that arguments are evaluated from right to left:
int i=10;
int f1()
{
static int i = 15;
printf("f1:%d ", i);
return i--;
}
main()
{... (2 Replies)
Discussion started by: arunviswanath
2 Replies
10. Solaris
I am running a SUN E450 on solaris (5.7). I have applied the DST patch and the system time is correct. However when users login the get the time wrong (+4 hours) (I am in EDT Zone). Does anyone know where a system wide variable for this could be set. (Root user gets the right time)
Frank (3 Replies)
Discussion started by: frankkahle
3 Replies