11-26-2012
Thx again Jotne
very Useful And Clear !
but, may you help me to find maximum value in certain column number 3; and then to print all line content:
here are my Inputs:
1 2 3
4 5 9
6 7 13
Ant the Output should have only:
6 7 13
thx for your time
10 More Discussions You Might Find Interesting
1. 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
2. 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
3. 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
4. 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
5. 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
6. 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
7. 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
8. 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
9. 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
10. 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
LEARN ABOUT DEBIAN
flow-print
flow-print(1) General Commands Manual flow-print(1)
NAME
flow-print -- Display flows in formatted ASCII.
SYNOPSIS
flow-print [-hlnpw] [-d debug_level] [-f format]
DESCRIPTION
The flow-print utility will display flow data in ASCII using pre-defined formats selectable with -f.
Some of the less descriptive column headers are defined below
Header Description
-------------------------------
Sif Source Interface ifIndex.
DiF Destination Interface ifIndex.
Pr Protocol.
P Protocol.
SrcP Source Port.
DstP Destination Port.
Pkts Packets.
Octets Octets (Bytes).
Active Time in ms the flow was active.
B/Pk Bytes per Packet.
Ts Type of Service.
Fl Flags, for TCP the cumulative or of the TCP control bits.
srcAS Source AS.
dstAS Destination AS.
Start Start time of the flow.
End End time of the flow.
router_sc V7 IP address of router producing shorcuts.
peer_nexthop V6 IP address of peer next hop IP address.
encap i/o Version 6 only. Encapsulation size in/out
duration Time in ms the flow was active.
input Input Interface ifIndex.
output Output Interface ifIndex.
flows Number of aggregated flows.
mTos V8.x ToS of pkts that exceeded the contract.
xpackets V8.x Packets that exceed the contract.
OPTIONS
-d debug_level
Enable debugging.
-f format Select format. The default is appropriate for the export type of the flow data. Available formats are:
0 1 line, interfaces, hex ports
1 2 line (includes timing and flags)
2 2 line candidate TCP syn attack flows
3 1 line, no interfaces, decimal ports
4 1 line with AS number
5 1 line, 132 column
6 show ip accounting emulation
7 1 line, 132 column +router_id
8 1 line, 132 column +encapsulation
9 1 line with tag values
10 AS aggregation
11 Protocol Port aggregation
12 Source Prefix aggregation
13 Destination Prefix aggregation
14 Prefix aggregation
15 Destination aggregation (Catalyst)
16 Source Destination aggregation (Catalyst)
17 Full Flow (Catalyst)
18 ToS AS Aggregation
19 ToS Proto Port aggregation
20 ToS Source Prefix aggregation
21 ToS Destination Prefix aggregation
22 ToS Prefix Aggregation
23 ToS Prefix Port aggregation
24 Full (Catalyst)
-h Display help.
-l Unbuffer output.
-n Use symbolic names where appropriate.
-p Display header information.
-w Wide output.
EXAMPLES
Display flows in flowfile
flow-print < flowfile
FILES
Configuration files:
Symbols - /etc/flow-tools/sym/*.
BUGS
None known.
AUTHOR
Mark Fullmer maf@splintered.net
SEE ALSO
flow-tools(1)
flow-print(1)