06-18-2007
I guess I can do this,
echo yahoo never | while read a b; do printf "%-10s %-20s" $a $b ; done
can someone tell me if there is another way to do this?
can you use xargs wd multiple argument?
10 More Discussions You Might Find Interesting
1. Programming
Hello!
First of all, sorry for my English, I'm not a native English speaker.
I know, that printf() function uses write() function. "man cancellation" says that write() function is a cancellation point. But when I call pthread_cancel() for my thread, which calls printf() in infinite cycle, it... (4 Replies)
Discussion started by: prankster
4 Replies
2. Programming
Hello *NIX gurus,
I have a slight perplexing problem with multiple forks giving different results... Here is the deal.
From what I undestand, a fork() call starts executing from the next instruction that follows the fork() call. That means it inherits the PC counter register value of the... (4 Replies)
Discussion started by: navigator
4 Replies
3. 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
4. UNIX for Dummies Questions & Answers
Hi,
Does anyone know a easy way to printf $3,$4, ... all the way to the last field in the file? I will need to modify $1 and $2 and then printf modified $1 and $2 and the rest of the fields(which are not changed).
I know I can use NF as the total number of field.
Do I use a for next statement to... (4 Replies)
Discussion started by: whatisthis
4 Replies
5. 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
6. 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
7. Shell Programming and Scripting
Target file contains short text (never more than 1 line) and filenames.
The format is, e.g.,:
TEXT1
filename1
TEXT2
TEXT3
filename3dddd
filename3dddd
TEXT4
filename4
TEXT5
filename5dddd
filename5dddd
filename5
where dddd is a random 4-digit whole number.
Desired output: (4 Replies)
Discussion started by: uiop44
4 Replies
8. UNIX for Dummies Questions & Answers
Hi,
I am using below awk code to convert a csv file data into fixed file format.
awk 'BEGIN { FS = ","
fmt = "%10s%010d%10s%d%1d\n" }
NR>1 { printf fmt, $1, $2, $3, $4*100, $5 }' /data/mydata.csv > /data/fixed.dat
Data in mydata.csv
================... (1 Reply)
Discussion started by: kbmkris
1 Replies
9. Shell Programming and Scripting
Hi,
I am using below awk code to convert a csv file data into fixed file format.
awk 'BEGIN { FS = ","
fmt = "%10s%010d%10s%d%1d\n" }
NR>1 { printf fmt, $1, $2, $3, $4*100, $5 }' /data/mydata.csv > /data/fixed.dat
Data in mydata.csv
================... (2 Replies)
Discussion started by: kbmkris
2 Replies
10. Shell Programming and Scripting
Hi Experts,
Quick question:
I am trying to get the output with decimal and floating point but not working:
echo "20.03" | awk '{printf "%03d.2f\n" , $0 }'
020.2f
How to get the output as :
020.03
Thank you. (4 Replies)
Discussion started by: rveri
4 Replies
LEARN ABOUT PHP
cubrid_fetch_assoc
CUBRID_FETCH_ASSOC(3) 1 CUBRID_FETCH_ASSOC(3)
cubrid_fetch_assoc - Return the associative array that corresponds to the fetched row
SYNOPSIS
array cubrid_fetch_assoc (resource $result, [int $type])
DESCRIPTION
This function returns the associative array, that corresponds to the fetched row, and then moves the internal data pointer ahead, or
returns FALSE when the end is reached.
PARAMETERS
o $result
-$result comes from a call to cubrid_execute(3)
o $type
-Type can only be CUBRID_LOB, this parameter will be used only when you need to operate the lob object.
RETURN VALUES
Associative array, when process is successful.
FALSE, when there are no more rows; NULL, when process is unsuccessful.
EXAMPLES
Example #1
cubrid_fetch_assoc(3) example
<?php
$conn = cubrid_connect("localhost", 33000, "demodb");
$req = cubrid_execute($conn, "SELECT name,area,seats,address FROM stadium WHERE nation_code='GRE' AND seats > 10000");
printf("%-40s %-10s %-6s %-20s
", "name", "area", "seats", "address");
while ($row = cubrid_fetch_assoc($req)) {
printf("%-40s %-10s %-6s %-20s
",
$row["name"], $row["area"], $row["seats"], $row["address"]);
}
// if you want to operate LOB object, you can use cubrid_fetch_assoc($req, CUBRID_LOB)
cubrid_close_request($req);
cubrid_disconnect($conn);
?>
The above example will output:
name area seats address
Panathinaiko Stadium 86300.00 50000 Athens, Greece
Olympic Stadium 54700.00 13000 Athens, Greece
Olympic Indoor Hall 34100.00 18800 Athens, Greece
Olympic Hall 52400.00 21000 Athens, Greece
Olympic Aquatic Centre 42500.00 11500 Athens, Greece
Markopoulo Olympic Equestrian Centre 64000.00 15000 Markopoulo, Athens, Greece
Faliro Coastal Zone Olympic Complex 34650.00 12171 Faliro, Athens, Greece
Athens Olympic Stadium 120400.00 71030 Maroussi, Athens, Greece
Ano Liossia 34000.00 12000 Ano Liosia, Athens, Greece
SEE ALSO
cubrid_execute(3), cubrid_fetch(3), cubrid_fetch_row(3), cubrid_fetch_array(3), cubrid_fetch_object(3).
PHP Documentation Group CUBRID_FETCH_ASSOC(3)