We can't just hand you an answer. We can help you build something but can't do the whole thing.
You can sum in awk like this:
If you make a BEGIN section, you can load lines from your other files with getline <"filename" statements to load the variables you want to skip later.
Hi everyone,
I need a help on Unix scripting.
I have a file is like this
Date Amt
20071205 10
20071204 10
20071203 200
20071204 300
20071203 400
20071205 140
20071203 100
20071205 100... (1 Reply)
Hi All,
I have a file like -
num.txt
12, 34, 65, line1
34, 65, 89, line2
43, 65, 77, line3
I want to do two things -
1. Add first three columns of each line and print the line with largest value.
i.e. (12+34+65) for 1st line and so on.
2. Add middle column of each line i.e.... (3 Replies)
Basically I have to process a text file which has been sorted this way:
John 12
John 13
John 10
John 900
Peter 20
Peter 30
Peter 32
The first column is a name, and the second an arbitrary value, both delimited by a space. How can I sum them up such that it would become:
John 935... (2 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Hi guys, i'm a new guy here, and it's my first time creating a unix script.
can you guys help me out here? i'd... (3 Replies)
a,b,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii
a thru ii are digits and strings....
The awk needed....if coloumn 9 == i (coloumn 9 is string ), output the sum of x's(coloumn 22 ) in all records and sum of y's (coloumn 23 ) in all records in a file (records.txt).... (6 Replies)
Can anyone tell me how sum values in each record of a file and append that value to the end? For instance a typical record will be:
FY12,Budget,771100,,,,,,,,,250,-250
I'd like the record to become
FY12,Budget,771100,,,,,,,,,250,-250,0
which can be put into another file.
Thank you. (6 Replies)
I have a file with the following format
AAAAA 1.34B 0.76B 0.00B 0.00B 0.00B 0.00B 0.00B 0.00B 0.00B 0.00B 0.00B 0.00B 0.00B 0.00B 0.90B 0.00B 0.00B 0.46B 0.00B 0.03B 0.00B ... (4 Replies)
Hello,
I am facing issue in summing up a column in unix.I am displaying a column sum up to 4 decimal places and below is the code snippet
sed '1d' abc.csv | cut -d',' -f7 | awk '{s+=$1}END{ printf("%.4f\n",s)}'
-170552450514.8603
example of data values in the column(not... (3 Replies)
Discussion started by: karthik adiga
3 Replies
LEARN ABOUT CENTOS
service
service(8) System Manager's Manual service(8)NAME
service - run a System V init script
SYNOPSIS
service SCRIPT COMMAND [OPTIONS]
service --status-all
service --help | -h | --version
DESCRIPTION
service runs a System V init script in as predictable environment as possible, removing most environment variables and with current working
directory set to /.
The SCRIPT parameter specifies a System V init script, located in /etc/init.d/SCRIPT. The supported values of COMMAND depend on the
invoked script, service passes COMMAND and OPTIONS it to the init script unmodified. All scripts should support at least the start and
stop commands. As a special case, if COMMAND is --full-restart, the script is run twice, first with the stop command, then with the start
command.
service --status-all runs all init scripts, in alphabetical order, with the status command.
If the init script file does not exist, the script tries to use legacy actions. If there is no suitable legacy action found and COMMAND is
one of actions specified in LSB Core Specification, input is redirected to the systemctl. Otherwise the command fails with return code 2.
FILES
/etc/init.d
The directory containing System V init scripts.
ENVIRONMENT
LANG, TERM
The only environment variables passed to the init scripts.
SEE ALSO chkconfig(8), ntsysv(8), systemd(1), systemctl(8), systemd.service(5)
Jan 2006 service(8)