10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a file that looks like this:
HP ColorPlotter Z-6100
ACMARTIN IP 192.168.x.x
"VIRTUAL HP ( C9468A ) PART 1 of 2 (REAL CARTRIDGE 1)"
"VIRTUAL HP ( C9468A ) PART 2 of 2 (REAL CARTRIDGE 1)"
181
181
"VIRTUAL HP ( C9471A ) PART 1 of 2 (REAL CARTRIDGE 2)"
"VIRTUAL HP ( C9471A ) PART 2... (4 Replies)
Discussion started by: SysAdminRialto
4 Replies
2. Shell Programming and Scripting
Hi Gurus,
I have requirement need to sum the value, the logic is if the value is negative then time -1, I tried below two ways. one is failed, another one doesn't work.
awk -F"," '{if($8< 0 $8*-1 else $8) sum+=$8}{print sum, $8} END{printf("%.2f\n",sum)}'
awk -F","... (4 Replies)
Discussion started by: ken6503
4 Replies
3. UNIX for Dummies Questions & Answers
I have a file with data merged from multiple files. File contains header, data and trailer of multiple files. The trailer starts with 99 and delimiter is ~.
Trailer
99~120
99~30
As it is a merged file we i have multiple lines followed by 99~. Need help to find sum of values which are there... (4 Replies)
Discussion started by: santoshdrkr
4 Replies
4. UNIX for Dummies Questions & Answers
Hi would like to ask you guys any advise regarding my problem
I have this kind of data
file.txt
111111111,20
111111111,50
222222222,70
333333333,40
444444444,10
444444444,20
I need to get this
file1.txt
111111111,70
222222222,70
333333333,40
444444444,30
using this code I can... (6 Replies)
Discussion started by: reks
6 Replies
5. Shell Programming and Scripting
Hi,
I need to assign values from a lines in a file into variables in unix, i am using Korn shell.
I tried the below script from posts but i am unable to fetch every value in a variable.
#! /usr/bin/ksh
#for file in test.txt; do
IFS=$'\|'
I=1
while read -a val
do
echo... (15 Replies)
Discussion started by: karthikram
15 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I would like to be able to sum up the counts of a column by the ID of another column. Example (although the actual file I have has thousands of IDs):
Input file:
A1BG-AS1:001 3
A1BG-AS1:002 0
A1BG-AS1:003 2
A1CF:001 1038
A1CF:002 105
A1CF:003 115
A1CF:004 137
Desired output... (3 Replies)
Discussion started by: fadista
3 Replies
7. Shell Programming and Scripting
Hi,
Taking sum up all values inside the file by using the below command:
paste -sd+ filenmae | bc
Getting some error like "0705-001: building space exceeded on line1 stdin"
The original data looks like
SPACE SPACE SPACE 0.123 JOBNAME1
SPACE SPACE 20.325 JOBNAME2
SPACE SPACE... (2 Replies)
Discussion started by: NareshN
2 Replies
8. Shell Programming and Scripting
I am running the following script :
cat ind_sls_extr_UX.out_sorted | while read each_rec
do
count=`echo "${each_rec}" | cut -c1-2`
if
then
final_amount=0
amount=`echo "${each_rec}" | cut -c280-287`
echo "${amount}"
final_amount=`expr ${amount} + ${amount}`
... (7 Replies)
Discussion started by: mady135
7 Replies
9. Shell Programming and Scripting
Hi.
Im looking for way to sum numbers from top. For example i have such command
top -b -n | grep Cpu | cut -c 35 - 39
which give me output 97.0 . Ho can i do with that value any arithmetic actions (for example 97.0 +1)?
Using
c = $((top -b -n | grep Cpu | cut -c 35 - 39))
gives me... (8 Replies)
Discussion started by: qdf
8 Replies
10. Shell Programming and Scripting
Hi
I am trying to add count values from two different files into one file. Could any body please suggest me best command to do this? My problem was as follows:
a.txt b.txt c.txt
10 20 30(needed)
i tried cat a.txt b.txt > c.txt (its not adding the values)
Thanks in advance..
Praveen (8 Replies)
Discussion started by: npk2210
8 Replies