Hi Experts,
I am adding a column of numbers with awk , however not getting correct output:
# awk '{sum+=$1} END {print sum}' datafile
2.15291e+06
How can I getthe output like : 2152910
Thank you..
# awk '{sum+=$1} END {print sum}' datafile
2.15079e+06 (3 Replies)
Hi,
I am presently stuck in a csv file.
INPUT CSV
baseball,NULL,8798765,Most played
baseball,NULL,8928192,Most played
baseball,NULL,5678945,Most played
cricket,NOTNULL,125782,Usually played
cricket,NOTNULL,678921,Usually played
EXPECTED OUTPUT CSV
... (7 Replies)
Hi
I have written below script to get the data in table form.
#!/bin/sh
echo "File Name\tType"
for i in *;
do
echo "$i\t\c"
if ; then
echo "directory"
elif ; then
echo "symbolic link"
elif ; then
echo "file"
else
echo "unknown"
fi
donehowever i am getting output in different way... (3 Replies)
Hi awk experts,
I am getting a strange output , may be it is normal but I am unable to comprehend,
When Using == operator it is showing correct:
# ls -l | awk '{for (i=0;i<=NF;i++) if ( $i =="info" )print $1,$6,$7,$8,$9}'
drwx------ Jan 17 10:44 info
But When using ~ (equal )... (4 Replies)
I've been working on improving my awk, and the next thing I want to learn is to properly use functions (I understand functions in shell and python). I have the following code which includes how I did this without functions before, and two attempts I've made to do it with functions:
function... (3 Replies)
Good Moring,
I am currently reading about awk in a manual and following the examples using the oratab file.
My system is SOLARIS 10
I think I am getting strange behavior judging by what the book says to do and what I am getting with my little program.
Here is my program:
grep -v oratab |... (4 Replies)
Hello,
I am practising awk and decided to compare two columns and print the result of the comparison as third column
i/p data
c1,c2,c3
1,a,b
1,b,b
i am trying to compare the last two columns and if they match I am trying to print match else mismatch(Ideally i want that as a last column... (5 Replies)
Hi Gurus,
I run command grep ABC file1 > file2 against below file. I got all ABC_xxx in one line in file2. I expect to get multiple lines in file2. If I print result in screen, the result is expected.
thanks in advance
My os is SunOS 5.10 Generic_150400-64 sun4v sparc sun4v
ABC_123
XXXXX... (2 Replies)