Sponsored Content
Top Forums Shell Programming and Scripting Extracting a field value from a line Post 302313557 by panyam on Wednesday 6th of May 2009 03:47:47 AM
Old 05-06-2009
Naresh,

The solution remain almost same, only change is u need to search for the "HOST" instead of "SERVICE_NAME".

Code:
cat tns_names.txt |tr '(' '\n' |sed 's/)/ /g' | awk '/HOST/ { print $3}'

You can google and you will get so many good doc's and information related to awk and sed.

Regards
Sastry
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extracting a field from directory path ??????

Hi I'll be getting a directory path as the input to the script. E.g. 1 abc/fsg/sdfhgsa/fasgfsd/adfghad/XXX/fhsad e.g. 2 sadfg/sadgjhgds/sd/dtuc/cghcx/dtyue/dfghsdd/XXX/qytq This input will be stored in a variable. My query is how to extract the field in a variable VAR which occurs... (15 Replies)
Discussion started by: skyineyes
15 Replies

2. Programming

Extracting Field values for XML file

i have an input file of XML type with data like <nx-charging:additional-parameter name="NX_INTERNATIONALIZED_CLID" value="919427960829"/><nx-charging:finalStatus>RESPONSE , Not/Applicable , OK</nx-charging:finalStatus></nx-charging:process> i want to extract data such that i get the output... (3 Replies)
Discussion started by: junaid.nehvi
3 Replies

3. Shell Programming and Scripting

Extracting field from array

I have a problem with the following lines of code: SaveIFS=$IFS IFS="/" declare -a Array=($1)#take unix path, split by '/' website=${Array} #stores website name The confusing part is that it works on one machine, but not on the other. If the code is... (2 Replies)
Discussion started by: montana24
2 Replies

4. Shell Programming and Scripting

Need help with extracting field

hi there, i'm new to shell scripting as i usually just use our solaris server for db administration and to get some basic system information. however i'm stuck with something that requires further scripting knowledge. I need to extract the Name, Desc and Status from pkginfo-l. I need them... (10 Replies)
Discussion started by: sbavanis
10 Replies

5. Shell Programming and Scripting

Extracting duplicates from a desired field

Hello, I have a file of group names and GID's (/etc/group) and I want to find the duplicate group names and put them in a file. So there are 2 fields, i.e.: audit 10 avahi 70 avahi-autoipd 103 bellrpi 605 bin 1 bin 2 bord 512 busobj 161 bwadm 230 cali81 202 card 323 cardiff 901 cbm... (2 Replies)
Discussion started by: mgb
2 Replies

6. Shell Programming and Scripting

Compare Field in Current Line with Field in Previous

Hi Guys I have the following file Essentially, I am trying to find the right awk/sed syntax in order to produce the following 3 distinct files from the file above: Basically, I want to print the lines of the file as long as the second field of the current line is equal to the... (9 Replies)
Discussion started by: moutaye
9 Replies

7. Shell Programming and Scripting

sed to replace a field from a line with another field

i have something like this, cat filename.txt hui this si s"dfgdfg" omeone ipaddress="10.19.123.104" wel hope this works i want to replace only 10.19.123.104 with different ip say 10.19.123.103 i tried this sed -i "s/'ipaddress'/'ipaddress=10.19.123.103'/g" filename.txt ... (1 Reply)
Discussion started by: vivek d r
1 Replies

8. Shell Programming and Scripting

awk - extracting a field

Hi all, I have automated a process of doing a sanity check for the DDL created by other DBA's. But i am stuck at a point. while reading a file in the awk, PI of the table is defined as )PRIMARY INDEX test_abc(ACCT_ID) PARTITION BY RANGE_N(AUTHZN_MTCH_IND BETWEEN DATE '2011-10-01' AND... (1 Reply)
Discussion started by: ysvsr1
1 Replies

9. Shell Programming and Scripting

Extracting field values from .csv

How can I select the bold fields from the following? "CLLI","SWREL","RPTDATE","RPTIME","TZ","RPTTYPE","RPTPD","IVALDATE","IVALSTART","IVALEND","NUMENTIDS" "tklc9010801","EAGLE5 45.0.0-64.70.1","2013-08-07","02:01:50","MST ","COMPONENT MEASUREMENTS ON... (4 Replies)
Discussion started by: leghorn
4 Replies

10. Shell Programming and Scripting

Command/script to match a field and print the next field of each line in a file.

Hello, I have a text file in the below format: Source Destination State Lag Status CQA02W2K12pl:D:\CAQA ... (10 Replies)
Discussion started by: pocodot
10 Replies
NETIO230A-CLI(1)					      General Commands Manual						  NETIO230A-CLI(1)

NAME
netio230a-cli - CLI to python-netio230a SYNOPSIS
netio230a-cli [--host HOST] [--port PORT] [--username USERNAME] [--password PASSWORD] -s SOCKET [--on] DESCRIPTION
netio230a-cli is a command line interface to access the Koukaam NETIO-230A, a cheap but advanced multiple socket with Ethernet control. Options: -? show help message and exit -h HOST, --host=HOST Hostname for the device (defaults to the first one found by the discovery in your LAN) -p PORT, --port=PORT TCP port (defaults to 1234) -u USERNAME, --username=USERNAME username to use for login (defaults to admin) -w PASSWORD, --password=PASSWORD password to use for login (will ask if left empty) -s SOCKET#, --socket=SOCKET# socketnumber (1-4) to switch on/off --on switch on when --on set, off if omitted AUTHOR
netio230a-cli was written by Philipp Klaus <philipp.l.klaus@web.de>. This manual page was written by Philipp Huebner <debalance@debian.org>, for the Debian project (and may be used by others). SEE ALSO
netio230a-discover(1), netio230a-gui(1) netio230a-cli 2010-03-09 NETIO230A-CLI(1)
All times are GMT -4. The time now is 04:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy