Sponsored Content
Special Forums UNIX and Linux Applications Infrastructure Monitoring How to concatenate this simple line in Unix? Post 302433242 by javygonx on Tuesday 29th of June 2010 04:29:28 AM
Old 06-29-2010
How to concatenate this simple line in Unix?

Hi:
I use the snmpget command everyday. And Im getting tire of writing the same line evertime I have to verify something.

Example of the line:

snmpget -c DreamTeam dal2-hr2 ifAlias.227

The .227 its the circuit interface and also its variable; could be any other number depending on the circuit id. So I create an alias in which it works:
alias sn='snmpget -c DreamTeam dal2-hr2'

So, now all I have to do its to write "sn ifAlias.227" and works fine; but!
if I create a new alias like:

alias sn='snmpget -c DreamTeam dal2-hr2 ifAlias." makes me an error;
so when I write "sn 227" it fails. Also if I did the alias without the "." and run the "sn .227" also fails.

How can I add the .227 to that ifAlias string. Or how to create a variable so
the "ifAlias.xxx" so makes the command works?!!

Thanks in advance!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to concatenate two command in one line and get the display in one screen

Hi, I would like to know , how to concatenate two command in one line and get the display in one screen for eg command 1 : ls -l /data/logs command 2 : ls -l /data/errors output shd be /data/logs /data/errors xx-xx-xx-xx abc.log xx-xx-xx-xx... (9 Replies)
Discussion started by: vasikaran
9 Replies

2. UNIX for Advanced & Expert Users

Need solution concatenate and display 2 lines as 1 with a condition for 2 line ?

I have 2 pattern of lines (SQL query and Time taken)in a log i need to capture all SQL queries with time taken >20 sec and need to display as one line. 2 lines from log: 2007-10-23 11:39:17,061 DEBUG - SQL Query : SELECT A.GROUP_CD , C.FN_CD FROM UP_GROUP A , PRD_GROUP_TO_FN B , PRD_FN... (1 Reply)
Discussion started by: vithala
1 Replies

3. Shell Programming and Scripting

concatenate and display 2 lines as 1 with a condition for 2 line ?

I have 2 pattern of lines (SQL query and Time taken)in a log i need to capture all SQL queries with time taken >20 sec and need to display as one line. 2 lines from log: 2007-10-23 11:39:17,061 DEBUG - SQL Query : SELECT A.GROUP_CD , C.FN_CD FROM UP_GROUP A , PRD_GROUP_TO_FN B , PRD_FN... (7 Replies)
Discussion started by: vithala
7 Replies

4. Shell Programming and Scripting

concatenate all duplicate line in a file.

Hi All, i have a zip file like the format 794051400123|COM|24|0|BD|R|99.98 794051413727|COM|11|0|BD|R|28.99 794051415622|COM|23|0|BD|R|28.99 883929004676|COM|0|0|BD|R|28.99 794051400123|MOM|62|0|BD|R|99.98 794051413727|MOM|4|0|BD|R|28.99 794051415622|MOM|80|0|BD|R|28.99 ... (30 Replies)
Discussion started by: vaskarbasak
30 Replies

5. UNIX for Advanced & Expert Users

need to concatenate two lines if the line doesnt end with quotes

Hi I am getting a source file where the columns are seperated by comma and double Quotes Eg1 : "AAA","BBB","CCCC" in the same source file i am also getting few lines where my last columns double quotes are ending in its next line or the next next line Eg2: "AAA","BBB","CCC CC"... (9 Replies)
Discussion started by: laxmi131
9 Replies

6. Shell Programming and Scripting

Concatenate strings line by line

Hi, I have a noob question . Can someone help me how to concatenate line by line using this variables? var1: Apple| Banana| var2: Red Yellow then how can I concatenate both line by line? in which the result would be: Apple|Red Banana|Yellow just to generate a row result i was... (6 Replies)
Discussion started by: hagdanan
6 Replies

7. Shell Programming and Scripting

Logfile - extracting certain lines to concatenate into 1 line

I've got a log file from automatic diagnostic runs. The log file is appended to each time an automatic log is run. I'd like to just pull certain lines from each run in the log file, and concatenate them into 1 comma delimited line (for export into excel or an html table). Each diagnostic run... (3 Replies)
Discussion started by: BecTech
3 Replies

8. Shell Programming and Scripting

awk concatenate every line of a file in a single line

I have several hundreds of tiny files which need to be concatenated into one single line and all those in a single file. Some files have several blank lines. Tried to use this script but failed on it. awk 'END { print r } r && !/^/ { print FILENAME, r; r = "" }{ r = r ? r $0 : $0 }' *.txt... (8 Replies)
Discussion started by: sdf
8 Replies

9. Shell Programming and Scripting

Concatenate small line with next line perl script

Hello to all, I'm new to perl, I have input file that contains the string below: 315350535ff450000014534130101ff4500ff45453779ff450ff45545f01ff45ff453245341ff4500000545000This string has as line separator "ff45". So, I want to print each line but the code below is not working. perl -pe '... (2 Replies)
Discussion started by: Ophiuchus
2 Replies

10. Shell Programming and Scripting

Help with concatenate multiple line into one line

Hi, Do anybody experience how to concatenate multiple line into one line by using awk or perl command? Input file: >set1 QAWEQRQ@EWQEASED ASDAEQW QAWEQRQTQ ASRFQWRGWQ From the above Input file, it got 5 lines Desired output file: >set1... (6 Replies)
Discussion started by: perl_beginner
6 Replies
SNMPGETNEXT(1)							     Net-SNMP							    SNMPGETNEXT(1)

NAME
snmpgetnext - communicates with a network entity using SNMP GET NEXT Requests. SYNOPSIS
snmpgetnext [COMMON OPTIONS] [-Cf] OID [OID]... DESCRIPTION
snmpget is an SNMP application that uses the SNMP GETNEXT request to query for information on a network entity. One or more object identi- fiers (OIDs) may be given as arguments on the command line. Each variable name is given in the format specified in variables(5). For each one, the variable that is lexicographically "next" in the remote entity's MIB will be returned. For example: snmpgetnext -c public zeus interfaces.ifTable.ifEntry.ifType.1 will retrieve the variable interfaces.ifTable.ifEntry.ifType.2: interfaces.ifTable.ifEntry.ifType.2 = softwareLoopback(24) If the network entity has an error processing the request packet, an error message will be shown, helping to pinpoint in what way the request was malformed. OPTIONS
snmpgetnext takes the common options described in the snmpcmd(1) manual page and also the -Cf option described in the snmpget(1) manual page. SEE ALSO
snmpcmd(1), snmpget(1), variables(5). 4th Berkeley Distribution 08 Feb 2002 SNMPGETNEXT(1)
All times are GMT -4. The time now is 08:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy