Sponsored Content
Full Discussion: unique entries needed
Top Forums Shell Programming and Scripting unique entries needed Post 302527690 by jacki on Saturday 4th of June 2011 01:46:38 PM
Old 06-04-2011
unique entries needed

Hi All,

I have the following command which returns the output like this -

PHP Code:
wget URL|grep hostname|awk '{print $1,$3}'|/usr/bin/perl -nle 'm{"(.*?)".*?//(.*):(\d+)/} and print "$1 $2 $3"'|while read host port
do
echo 
check_env_$port
echo host
done 
OUTPUT
Appname hostname port
Appname2 hostname port2 ...

Appnames are all unique , while hostname is not since I am grepping for single hostname(vip).
Some of the ports are not unique so I am getting the same port for 4-5 different appnames.

Within the same snippet of code I want to add a number to echo command so the its unique..
e.g. check_env_1_1234
check_env_2_1234

So for port 1234 it should increment the numbers.

If that's too hard then atleast get unique entries so that I don't get check_env_1234 not more than once which ever comes first and ignore the rest of the entries with the same port.

Thanks,
Jack.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

get part of file with unique & non-unique string

I have an archive file that holds a batch of statements. I would like to be able to extract a certain statement based on the unique customer # (ie. 123456). The end for each statement is noted by "ENDSTM". I can find the line number for the beginning of the statement section with sed. ... (5 Replies)
Discussion started by: andrewsc
5 Replies

2. Shell Programming and Scripting

Finding unique entries without sorting

Hi Guys, I have two files that I am using: File1 is as follows: wwe khfgv jfo jhgfd hoaha hao lkahe This is like a master file which has entries in the order which I want. (4 Replies)
Discussion started by: npatwardhan
4 Replies

3. Shell Programming and Scripting

Filtering a file for unique entries

Hi All, I am trying to filter out a txt file containing 2 columns. Which has got website name and response time as below. Website_name response_time yahoo 22 google 21 yahoo 34 rediff 45 google 43 rediff 31 I want filter the above file with unique website names which has got highest... (5 Replies)
Discussion started by: anilreddy103
5 Replies

4. Shell Programming and Scripting

unique entries

Hi, I have a file ENST12345 yes ENST11445 no ENST12345 yes ENST24689 no ENST24689 yes ENST34567 no what I want is for each unique identifier if atleast one of them has a value of "yes" then all of it entries need to be imported or else it should be skipped. o/p... (2 Replies)
Discussion started by: Diya123
2 Replies

5. Shell Programming and Scripting

Change unique file names into new unique filenames

I have 84 files with the following names splitseqs.1, spliseqs.2 etc. and I want to change the .number to a unique filename. E.g. change splitseqs.1 into splitseqs.7114_1#24 and change spliseqs.2 into splitseqs.7067_2#4 So all the current file names are unique, so are the new file names.... (1 Reply)
Discussion started by: avonm
1 Replies

6. Shell Programming and Scripting

Deriving unique entries from multiple repeating patterns

Dear All, I have a below one column data.(example) Col1 1 2 . . 25 8 9 25 1 2 . . 25 Where each entry(row) is a number from 1-25, but in place whereever mentioned with . we have all the entries 1-25, but some places where ever no . like in 8 9 25 I have only 3 entries. No I... (14 Replies)
Discussion started by: ks_reddy
14 Replies

7. UNIX for Dummies Questions & Answers

Print unique lines without sort or unique

I would like to print unique lines without sort or unique. Unfortunately the server I am working on does not have sort or unique. I have not been able to contact the administrator of the server to ask him to add it for several weeks. (7 Replies)
Discussion started by: cokedude
7 Replies

8. UNIX for Dummies Questions & Answers

Sorting and saving values based on unique entries

Hi all, I wanted to save the values of a file that contains unique entries based on a specific column (column 4). my sample file looks like the following: input file: 200006-07file.txt 145 35 10 3 147 35 12 4 146 36 11 3 145 34 12 5 143 31 15 4 146 30 14 5 desired output files:... (5 Replies)
Discussion started by: ida1215
5 Replies

9. Shell Programming and Scripting

Unique entries based on a range of numbers.

Hi, I have a matrix like this: Algorithm predicted_gene start_point end_point A x 65 85 B x 70 80 C x 75 85 D x 10 20 B y 125 130 C y 120 140 D y 200 210 Here there are four tab-separated columns. The first column is the used algorithm for prediction, and there are 4 of them A-D.... (8 Replies)
Discussion started by: flyfisherman
8 Replies

10. Shell Programming and Scripting

Unique entries in multiple files

Hello, I have a directory with a log files(many of them). Lines look like this: Sep 1 00:05:05 server9 pop3d-ssl: LOGIN, user=abc@example.com, ip=, port= Sep 1 00:05:05 server9 pop3d-ssl: LOGOUT, user=abc@example.com, ip=, port=, top=0, retr=0, rcvd=12, sent=46, time=0 Sep 1 00:05:05... (19 Replies)
Discussion started by: ramirez987
19 Replies
SSH-ARGV0(1)                                                BSD General Commands Manual                                               SSH-ARGV0(1)

NAME
ssh-argv0 -- replaces the old ssh command-name as hostname handling SYNOPSIS
hostname | user@hostname [-l login_name] [command] hostname | user@hostname [-afgknqstvxACNTX1246] [-b bind_address] [-c cipher_spec] [-e escape_char] [-i identity_file] [-l login_name] [-m mac_spec] [-o option] [-p port] [-F configfile] [-L port:host:hostport] [-R port:host:hostport] [-D port] [command] DESCRIPTION
ssh-argv0 replaces the old ssh command-name as hostname handling. If you link to this script with a hostname then executing the link is equivalent to having executed ssh with that hostname as an argument. All other arguments are passed to ssh and will be processed normally. OPTIONS
See ssh(1). FILES
See ssh(1). AUTHORS
OpenSSH is a derivative of the original and free ssh 1.2.12 release by Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo de Raadt and Dug Song removed many bugs, re-added newer features and created OpenSSH. Markus Friedl contributed the support for SSH protocol versions 1.5 and 2.0. Jonathan Amery wrote this ssh-argv0 script and the associated documentation. SEE ALSO
ssh(1) Debian Project September 7, 2001 Debian Project
All times are GMT -4. The time now is 11:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy