Sponsored Content
Special Forums IP Networking How do delete unwanted characters from lsof? Post 302507125 by grigorianvlad on Tuesday 22nd of March 2011 09:10:37 PM
Old 03-22-2011
How do delete unwanted characters from lsof?

Hi. I need to trace on Unix level number of connections to an Oracle database. The listener runs on port 1521.
The following is run:
Code:
oracle@server03 >lsof -Pni |grep ".1521" |grep IPv4 | awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1
  87 IPv4
oracle@server03 >

I need to append these values into a text file every 5 mins through cron. That part works. The problem I am having is getting rid of the "IPv4" string. I just need number of connections and nothing else:

87
88
87

How do I change the statement so it only returns the numbers?
Thanks.

Last edited by vbe; 03-24-2011 at 05:54 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Diff output, unwanted characters

I've got a diff command running in a shell script that writes the ouput to a new file. In the new file there is a ">" at the beginning of each line. The output file is going to be used by another program and that character makes the file useless. What I'm getting in the new file: > 2007-09-27... (5 Replies)
Discussion started by: scanner248
5 Replies

2. AIX

Delete specific characters

Hi every1 Well i have a list of numbers e.g 12304 13450 01234 00123 14567 what i want is a command to check if the number is starting from 0 and then delete the 0 without doing anything else!!!! any help wud b appreciated!!!!!!!!:( (4 Replies)
Discussion started by: masquerer
4 Replies

3. Shell Programming and Scripting

to replace unwanted new line characters

Hi how to replace un wanted new line characters. my file contains data like. ramu,sony,"raju \n ravi \n ramya" \n ravi,sarah,"sowmya \n sorry s\ sangam" \n i want replace new line characters in between double coats with single space. for example $ cat input_file ramu,sony,"raju... (3 Replies)
Discussion started by: Raghava
3 Replies

4. Shell Programming and Scripting

Delete not readable characters

Hi All, I wanted to delete all the unwanted characters in the string. ie, to delete all the characters which are not alpha numeric values. var1="a./bc" var2='abc/\."123' like to get the output as print var1 abc print var2 abc123 Could you guys help me out pls. Your help is... (3 Replies)
Discussion started by: ajilesh
3 Replies

5. Shell Programming and Scripting

removing unwanted characters from a file

i have a file like this 1111_2222#$#$dudgfdk 11111111_343434#$#$334 1111_22222#43445667 i want to remove all those charachetrs from # how can i do this Thank in advance Saravanan (4 Replies)
Discussion started by: saravanan71184
4 Replies

6. Shell Programming and Scripting

Need to delete unwanted files!!!

Hi all, i am just a beginner in shell. Need some code for my problem. SCENARIO I have 2 directories. Let A,B. Everyday files from directory A are compressed and moved to B.(already got the script). In directory A abc.doc def.exe ghi.c jkl.pl In directory B abc.tar.gz... (1 Reply)
Discussion started by: debu182
1 Replies

7. Shell Programming and Scripting

Delete characters from each line

Hi, I have a file that has data in the following manner, tt_0.00001.dat 123.000 tt_0.00002.dat 124.000 tt_0.00002.dat 125.000 This is consistent for all the entries in the file. I want to delete the 'tt_' and '.dat' from each line. Could anyone please guide me how to do this using awk or... (2 Replies)
Discussion started by: lost.identity
2 Replies

8. Shell Programming and Scripting

sed to get rid of unwanted characters

so i have strings such as this: 'postfix/local#2,5#|CRON.*12062.*root.*CMD#2,5#|roice.*NQN1#1,2#|toysprc#1,4#' i need to get rid of the "#" and the numbers between them for each of the strings above. so the desired output should be: ... (1 Reply)
Discussion started by: SkySmart
1 Replies

9. Shell Programming and Scripting

Stripping unwanted characters in field

I wrote myself a small little shell script to clean up a file I have issues with. In particular, I am stripping down a fully qualified host/domain name to just the hostname itself. The script works, but from a performance standpoint, it's not very fast and I will be working with large data sets. ... (4 Replies)
Discussion started by: dagamier
4 Replies

10. Shell Programming and Scripting

Delete special characters

My sed is not working on deleting the entire special characters and leaving what is necessary.grep connections_per a|sed -e 's/\<\!\-\-//g' INPUT: <!-- <connections_per_instance>1</connections_per_instance> --> <method>HALF</method> <!--... (10 Replies)
Discussion started by: kenshinhimura
10 Replies
ashunt(8)							netsniff-ng-toolkit							 ashunt(8)

NAME
ashunt - Autonomous System (AS) trace route utility SYNOPSIS
ashunt -H|--host <host> -i|-d|--dev <dev> [-6|--ipv6] [-n|--numeric] [-N|--dns] [-f|--init-ttl <ttl>] [-m|--max-ttl <ttl>] [-q|--num-probes] [-x|--timeout <sec>] [-S|--syn] [-A|--ack] [-F|--fin] [-P|--psh] [-U|--urg] [-R|--rst] [-E|--ecn-syn] [-t|--tos <tos>] [-G|--nofrag] [-X|--payload <string>] [-Z|--show-packet] [-l|--totlen <len>] [-w|--whois <server>] [-W|--wport <port>] [--city-db <path>] [--country-db <path>] [-v|--version] [-h|--help] DESCRIPTION
This program provides AS information on each hop between the client and the target host. OPTIONS
ashunt -i eth0 -N -E -H netsniff-ng.org IPv4 trace of AS with TCP ECN SYN probe ashunt -i eth0 -N -S -H netsniff-ng.org IPv4 trace of AS with TCP SYN probe ashunt -i eth0 -N -F -H netsniff-ng.org IPv4 trace of AS with TCP FIN probe ashunt -i eth0 -N -FPU -H netsniff-ng.org IPv4 trace of AS with Xmas probe ashunt -i eth0 -N -H netsniff-ng.org -X "censor-me" -Z IPv4 trace of AS with Null probe with ASCII payload ashunt -6 -S -i eth0 -H netsniff-ng.org IPv6 trace of AS up to netsniff-ng.org OPTIONS
-h|--help Print help text and lists all options. -v|--version Print version. -H|--host <host> Host/IPv4/IPv6 to lookup AS route to i-|-d|--dev <netdev> Networking device, i.e. eth0 -p|--port <port> Hosts port to lookup AS route to -4|--ipv4 Use IPv4 requests (default) -6|--ipv6 Use IPv6 requests -n|--numeric Do not do reverse DNS lookup for hops -N|--dns Do a reverse DNS lookup for hops -f|--init-ttl <ttl> Set initial TTL -m|--max-ttl <ttl> Set maximum TTL (default: 30) -q|--num-probes <num> Number of max probes for each hop (default: 3) -x|--timeout <sec> Probe response timeout in sec (default: 3) -S|--syn Set TCP SYN flag in packets -A|--ack Set TCP ACK flag in packets -F|--fin Set TCP FIN flag in packets -P|--psh Set TCP PSH flag in packets -U|--urg Set TCP URG flag in packets -R|--rst Set TCP RST flag in packets -E|--ecn-syn Send ECN SYN packets (RFC3168) -t|--tos <tos> Set the IP TOS field -w|--whois <server> Use a different AS whois DB server (default: /etc/netsniff-ng/whois.conf) -W|--wport <port> Use a different port to AS whois server (default: /etc/netsniff-ng/whois.conf) --city-db <path> Specifiy path for geoip city database --country-db <path> Specifiy path for geoip country database AUTHOR
Written by Daniel Borkmann <daniel@netsniff-ng.org> DOCUMENTATION
Documentation by Emmanuel Roullit <emmanuel@netsniff-ng.org> BUGS
Please report bugs to <bugs@netsniff-ng.org> 2012-06-29 ashunt(8)
All times are GMT -4. The time now is 10:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy