Sponsored Content
Full Discussion: AWK/GREP sorting help
Top Forums Shell Programming and Scripting AWK/GREP sorting help Post 302443965 by sam127 on Tuesday 10th of August 2010 02:15:15 PM
Old 08-10-2010
AWK/GREP sorting help

hi everyone, I am kind of new to this forum. I need help in sorting this data out accordingly, I am actually doing a traceroute application and wants my AS path displayed in front of my address like this;
192.168.1.1 AS28513 AS65534 AS5089 AS5089 .... till the last AS number and if possible sort for uniq AS number so that there wont repetion as it occurs below.

From data like below;

Code:
 1  192.168.1.1 (192.168.1.1) [AS28513]  4.305 ms  4.150 ms  5.069 ms
 2  10.193.108.1 (10.193.108.1) [AS65534]  17.308 ms  17.716 ms  18.170 ms
 3  leic-cam-1a-v134.network.virginmedia.net (82.3.36.29) [AS5089]  19.280 ms  19.715 ms  20.731 ms
 4  leic-core-1a-ae1-0.network.virginmedia.net (195.182.174.129) [AS5089]  20.226 ms  23.771 ms  24.368 ms
 5  leed-bb-1a-as8-0.network.virginmedia.net (213.105.172.17) [AS5089]  27.425 ms  26.590 ms  31.437 ms
 6  leed-bb-1b-ae0-0.network.virginmedia.net (62.253.187.186) [AS5089]  32.144 ms  42.170 ms  42.660 ms
 7  nrth-bb-1a-as0-0.network.virginmedia.net (213.105.175.133) [AS5089]  17.566 ms  17.743 ms  21.289 ms
 8  fran-ic-1-as0-0.network.virginmedia.net (62.253.185.81) [AS5089]  37.432 ms  36.812 ms  37.800 ms
 9  te0-7-0-7.mpd22.fra03.atlas.cogentco.com (130.117.14.133) [AS174]  41.965 ms  42.538 ms  42.975 ms

Thanks for you anticipated help.

Last edited by pludi; 08-10-2010 at 07:50 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep sorting/formatting

Hi, I currently have many log files for different webpages inside the folder /log/. The program allows the user to enter a month and then the grep function searches for it, the command i used is below: grep -c "$month" ./log/*.log This works and i can ascertain the number of matches, but I... (10 Replies)
Discussion started by: Jaken
10 Replies

2. Shell Programming and Scripting

awk sorting

Hi, I have used the following code to sort two sets of data: awk '{printf "%10s %s\n",$1,$2}' The first column is text and the second involves numbers. I was just wondering how i would go about sorting the second number so that they ascend from the top? Thanks for any help (4 Replies)
Discussion started by: Jaken
4 Replies

3. Shell Programming and Scripting

sorting in awk

i have following file have following type of data 1~%%~fcashfafh~%%~9797 can i sort(numeric) the file on first field and then on last feild using awk (3 Replies)
Discussion started by: mahabunta
3 Replies

4. Shell Programming and Scripting

Is there any better way for sorting in bash/awk

Hi, I have a file which is:- 1 6 4 8 2 3 2 1 9 3 2 1 3 3 5 6 3 1 4 9 7 8 2 3 I would like to sort from field $2 to field $6 for each of the line to:- 1 2 3 4 6 8 2 1 1 2 3 9 3 1 3 3 5 6 4 2 3 7 8 9 I came across this Arrays on example 26-6. But it is much complicated. I am... (7 Replies)
Discussion started by: ahjiefreak
7 Replies

5. Shell Programming and Scripting

Sorting with sed,awk ...

I need to sort this input using sed, awk or any other tool to give below output Input: RXOCF-8 CLASS 2A 57 RU 40 RXORX-8-0 CLASS 1B 23 45 16 RXORX-8-1 EXTERNAL CLASS 2A (12 Replies)
Discussion started by: aydj
12 Replies

6. Shell Programming and Scripting

Sorting inside awk

I have an array with five columns and i want to write it to a file. Before writing it i must sort it using the field in the fifth column. _________________________________________ |field 1|field 2|field 3|field 4|field 5| | | | | | | | | | |... (6 Replies)
Discussion started by: beatblaster666
6 Replies

7. Shell Programming and Scripting

Sorting a .csv using awk or other

Hello all, I am new here and *relatively* new to Unix. I have a bit of an emergency. I have a three column file that I need to sort: sample name, miRNA, reads per million (RPM) There are multiple samples, and for each sample name there are multiple miRNAs and associated RPMs. Some of these... (6 Replies)
Discussion started by: dunnybocter
6 Replies

8. Shell Programming and Scripting

Sorting within a record using AWK

Hello, I have a file which has the following format: I have to do is sort individual records in the file based on the 4th field. Each record starts with "Module". Is there an easy way to do this using awk. I have tried piping output from awk to sort and also using "sort" inside awk but... (8 Replies)
Discussion started by: fifteate
8 Replies

9. UNIX for Dummies Questions & Answers

GREP for sorting

Hi , I have a file which has a large number of sequences of type: gi_1 AASSKSKSKSSKSKSK.... series_121 DDKFKFKGKGKH gi_3 FFFFLFFLFLFLF series_1 DFFFFFF pattern_3 GEEEEEEEEE gi_2 HKKGGKGKGK series_102 HHHHH pattern_1 (2 Replies)
Discussion started by: siya@
2 Replies

10. Homework & Coursework Questions

Shell Script: Sorting by column using grep/awk

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: You will write a script that will read a tab-separated file that contains the names of all 50 states &... (7 Replies)
Discussion started by: tburns517
7 Replies
RLM_IPPOOL_TOOL(8)					      System Manager's Manual						RLM_IPPOOL_TOOL(8)

NAME
rlm_ippool_tool - dump the contents of the FreeRadius ippool database files SYNOPSIS
If an ipaddress is specified then that address is used to limit the actions or output. rlm_ippool_tool [-a] [-c] [-o] [-v] session-db index-db [ipaddress] Mark the entry nasIP/nasPort as having ipaddress rlm_ippool_tool -n session-db index-db ipaddress nasIP nasPort Update old format database to new. rlm_ippool_tool -u session-db new-session-db DESCRIPTION
rlm_ippool_tool dumps the contents of the FreeRADIUS ippool databases for analyses or for removal of active (stuck?) entries. Or with the -n argument adds a usage entry to the FreeRADIUS ippool databases. OPTIONS
-a Print all active entries. -c Report number of active entries. -r Remove active entries. -v Verbose report of all entries. -o Assume old database format (nas/port pair, not md5 output). -n Mark the entry nasIP/nasPort as having ipaddress. -u Update old format database to new. EXAMPLES
Given the syntax in the FreeRadius radiusd.conf: ippool myippool { range-start = 192.168.1.0 range-stop = 192.168.1.255 [...] session-db = ${raddbdir}/ip-pool.db ip-index = ${raddbdir}/ip-index.db } To see the number of active entries in this pool, use: $ rlm_ippool_tool -c ip-pool.db ip-index.db 13 To see all active entries in this pool, use: $ rlm_ippool_tool -a ip-pool.db ip-index.db 192.168.1.5 192.168.1.82 192.168.1.244 192.168.1.57 192.168.1.120 192.168.1.27 [...] To see all information about the active entries in the use, use: $ rlm_ippool_tool -av ip-pool.db ip-index.db NAS:172.16.1.1 port:0x2e8 - ipaddr:192.168.1.5 active:1 cli:0 num:1 NAS:172.16.1.1 port:0x17c - ipaddr:192.168.1.82 active:1 cli:0 num:1 NAS:172.16.1.1 port:0x106 - ipaddr:192.168.1.244 active:1 cli:0 num:1 NAS:172.16.1.1 port:0x157 - ipaddr:192.168.1.57 active:1 cli:0 num:1 NAS:172.16.1.1 port:0x2d8 - ipaddr:192.168.1.120 active:1 cli:0 num:1 NAS:172.16.1.1 port:0x162 - ipaddr:192.168.1.27 active:1 cli:0 num:1 [...] To see only information of one entry, use: $ rlm_ippool_tool -v ip-pool.db ip-index.db 192.168.1.1 NAS:172.16.1.1 port:0x90 - ipaddr:192.168.1.1 active:0 cli:0 num:0 To add an IP address usage entry, use: $ rlm_ippool_tool -n ip-pool.db ip-index.db 192.168.1.1 172.16.1.1 0x90 rlm_ippool_tool: Allocating ip to nas/port: 172.16.1.1/144 rlm_ippool_tool: num: 1 rlm_ippool_tool: Allocated ip 192.168.1.1 to client on nas 172.16.1.1,port 144 SEE ALSO
radiusd(8) AUTHORS
Currently part of the FreeRADIUS Project (http://www.freeradius.org) Originally by Edwin Groothuis, edwin@mavetju.org (http://www.mavetju.org) Mailing list details are at http://www.freeradius.org/ RLM_IPPOOL_TOOL(8)
All times are GMT -4. The time now is 02:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy