10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi all i need to add the prinf statement in awk command for the converted comma separated output....
below is my code :
Code Credits :RudiC
awk -F, 'NF==2 {next}
{ITM=$1
AMT=$2+0
CNT=$3+0
TOTA+=$2
... (4 Replies)
Discussion started by: hemanthsaikumar
4 Replies
2. Shell Programming and Scripting
I have a lines like below, captured from rrdtool fetch command,
1395295200 2.0629986254e+06 7.4634784967e+05
1395297000 2.0198121616e+06 6.8658888903e+05
1395298800 1.8787141122e+06 6.7482866452e+05
1395300600 1.7586118678e+06 6.7867977653e+05
1395302400 1.8222762151e+06 7.1301678859e+05I'm... (3 Replies)
Discussion started by: rk4k
3 Replies
3. Shell Programming and Scripting
Hi,
I am studying an awk command:
awk '{ sub(/\/\/.*/, "", $NF); print }' input.txt
The input.txt is:
char*s1="//hello"; //comment
//delete
/* hello //*/
The output is :
char*s1="//hello";
/* hello (2 Replies)
Discussion started by: jeffwang66
2 Replies
4. 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
5. 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
6. UNIX for Dummies Questions & Answers
I have a script problem that I am not able to solve due my very limited understanding of unix/awk.
This is the contents of test.sh
awk '{print $1}'
From the prompt if I enter:
./test.sh Hello World
I would expect to see "Hello" but all I get is a blank line. Only then if I enter "Hello... (2 Replies)
Discussion started by: JasonHamm
2 Replies
7. 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
8. Shell Programming and Scripting
can you take input from another command and do printf?
such as
awk '{print $2,$1}' | sort -k1,1 -k2,2 | printf "%-10s,%15s"
this does not work.. but there must be a way.. please help me..
thank you. (3 Replies)
Discussion started by: hankooknara
3 Replies
9. 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
10. 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