Sponsored Content
Top Forums Shell Programming and Scripting matching first instance of FS Post 302187752 by gurukottur on Tuesday 22nd of April 2008 02:16:04 AM
Old 04-22-2008
matching first instance of FS

Hi All,

I have a property in a file as:
property=value=a


If I use FS="=" then I want only first = to be considered as field separator and remaining as value
Code:
echo -e "property=value=a" | awk -F= '{print $2}'

ie my $2 should be value=a

Can anyone please help me with this. I need it in awk

Thanks in Advance
Guru

Last edited by Yogesh Sawant; 04-22-2008 at 04:28 AM.. Reason: added code tags
 

10 More Discussions You Might Find Interesting

1. Linux

OTRS instance

hi frnds here i m trying to configure OTRS instance but i m getting the following error message while runnning through browser. I m writing the following http://192.168.1.55:8080/otrs2/index.pl " #!/usr/bin/perl -w... (7 Replies)
Discussion started by: naik_mit
7 Replies

2. Shell Programming and Scripting

replace first instance(not first instance in line)

Alright, I think I know what I am doing with sed(which probably means I don't). But I cant figure out how to replace just the first occurance of a string. I have tried sed, ed, and grep but can't seem to figure it out. If you have any suggestions I am open to anything! (3 Replies)
Discussion started by: IronHorse7
3 Replies

3. Shell Programming and Scripting

Sed on first instance only

Hi, I've been trying to figure this one out and found a post about this on the forum here but the solution didn't seem to work for me. Basically what I have is a file that looks something like: stuff morestuff 0 otherthing 0 etc I want to substitute for the 0 but what I want to... (9 Replies)
Discussion started by: eltinator
9 Replies

4. Shell Programming and Scripting

What does : do in this instance

Guys please see below functions to return a status depending on user input. Both seem to work the same. The second way has a : line which i can't understand or see in a ksh manual anywhere. Instead of doing the variable change if its empty on this line the first function simply does it on the... (7 Replies)
Discussion started by: lavascript
7 Replies

5. Shell Programming and Scripting

Keep the last instance of the record

Hi All, I have a input file like 1| abc 1| abcd 1| abcde 2| abc 2| abcd 3| abcde I want the output like 1| abcde 2| abcde Any help would be highly appreciated. Thanks in advance. (9 Replies)
Discussion started by: lrkp
9 Replies

6. Shell Programming and Scripting

sed/awk: Delete matching words leaving only the first instance

I have an input text that looks like this (comes already sorted): on Caturday 22 at 10:15, some event on Caturday 22 at 10:15, some other event on Caturday 22 at 21:30, even more events on Funday 23 at 11:00, yet another event I need to delete all the matching words between the lines, from... (2 Replies)
Discussion started by: GrinningArmor
2 Replies

7. Shell Programming and Scripting

Insert lines above matching line with content from matching

Hi, I have text file: Name: xyz Gender: M Address: "120_B_C; ksilskdj; lsudlfw" Zip: 20392 Name: KLM Gender: F Address: "65_D_F; wnmlsi;lsuod;,...." Zip:90233I want to insert 2 new lines before the 'Address: ' line deriving value from this Address line value The Address value in quotes... (1 Reply)
Discussion started by: ysrini
1 Replies

8. UNIX for Advanced & Expert Users

Grep the only instance name

Hi, I want to get the only application name from the server. Ex: if i give $ ps -ef | grep bw. It will show all BW process with entire path. It will little confuse to list out the process. Can anyone have syntax to get only the instance name. I need this for be, hawk,ems also. Please... (2 Replies)
Discussion started by: ckchelladurai
2 Replies

9. Shell Programming and Scripting

Compare file1 for matching line in file2 and print the difference in matching lines

Hello, I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
Discussion started by: RasB15
2 Replies

10. Shell Programming and Scripting

awk to combine all matching dates and remove non-matching

Using the awk below I am able to combine all the matching dates in $1, but I can not seem to remove the non-matching from the file. Thank you :). file 20161109104500.0+0000,x,5631 20161109104500.0+0000,y,2 20161109104500.0+0000,z,2 20161109104500.0+0000,a,4117... (3 Replies)
Discussion started by: cmccabe
3 Replies
svcprop(1)																svcprop(1)

NAME
svcprop - retrieve service configuration properties SYNOPSIS
svcprop [-fqtv] [-C | -c | -s snapshot] [-p [name/]name]... [FMRI | pattern]... svcprop -w [-fqtv] [-p [name/]name] {FMRI | pattern} The svcprop utility prints values of properties in the service configuration repository. Properties are selected by -p options and FMRI op- erands. By default, when a single property is selected, its values are printed separated by spaces on a single line. Empty ASCII string values are represented by a pair of double quotes (""). Bourne shell metacharacters (';', '&', '(', ')', '|', '^', '<', '>', newline, space, tab, backslash, '"', single-quote, '`') in ASCII string values are quoted by backslashes (). When multiple properties are selected, a single line is printed for each. Each line comprises a property designator, a property type, and the values (as described above), separated by spaces. By default, if a single FMRI operand has been supplied, the property designator con- sists of the property group name and the property name joined by a slash (/). If multiple FMRI operands are supplied, the designator is the canonical FMRI for the property. A composed property may be selected directly from the entities which match a specified FMRI or from entities which may be used as a source of properties for these matching entities. An example of a composed property is a property which is set on a service, which may be selected when an instance matching an FMRI does not possess the property itself. An un-composed property selection is made against the specified FMRI with no further searching of additional sources of properties other than the entities which match the designated FMRI. Properties are displayed either with or without composition depending on the options which are supplied at invocation. Properties are com- posed by default. A snapshot, which is a point in time representation of the state of a matching entity's properties at a moment in time, always uses compo- sition because snapshots are always composed. Error messages are printed to the standard error stream. Many properties have specific meanings to the Service Management Facility or the service's restarter. The following options are supported: -C Retrieves the current property values, without composition. -c Retrieves the current property values, with composition. -f Designates properties by their FMRIs. Implies option -t. -p [name/]name Prints values of the named property or property group for each of the property groups, instances, or services spec- ified by the operands. -q Quiet. Produces no output. -s snapshot Uses the named snapshot to retrieve the specified property or property group, with composition (since snapshots are always composed). If the given property group is not present in the snapshot, the current property values are exam- ined. -t Uses the multi-property output format. -v Verbose. Prints error messages for nonexistent properties, even if option -q is also used. -w Waits for the selected property group or property to change before printing anything. This option is only valid when a single entity is given. If more than one operand is given, or an operand matches more than one instance, an error message is printed and no action is taken. The -w option always causes svcprop to operate against current property values. The following operand is supported: FMRI With no -p options, FMRI operands can name a service, instance, property group, or property. For services, service instances, and property groups, all contained properties are selected. Instances and services can be abbreviated by specifying the instance name, or the trailing portion of the service name. Properties and property groups must be specified by a full FMRI. For example, given the FMRI: svc:/network/smtp:sendmail The following are valid abbreviations: sendmail :sendmail smtp smtp:sendmail network/smtp The following are invalid abbreviations: mail network network/smt Abbreviated forms of FMRIs are unstable and should not be used in scripts or other permanent tools. Arguments to the -p option can name property groups or properties. In the former case, operands can name services or instances, and all properties in the named property group of the named services or instances are printed. In the latter, operands can name services, instances, or property groups, and the named properties belonging to the operands are printed. By default, all properties are selected from the running snapshot, with composition. If there is no running snapshot, then current properties are selected. The -w and -s options can be used to change the source of properties. When walking properties, that is, no -p options, current nonpersistent property groups are also selected. With -p options, if the property group doesn't exist in the running snapshot, then if the property group is nonpersistent the current property or property group is selected. Example 1: Displaying the Value of a Single Property The following example displays the value of the enabled property in the general property group of instance default of service inetd. example% svcprop -p general/enabled network/inetd:default true Example 2: Displaying All Properties in a Property Group This example displays all properties in the general property group of service ntp. example% svcprop -p general ntp general/entity_stability astring Unstable general/single_instance boolean true Example 3: Verifying the Existance of a Property This example verifies the existence of the general/enabled property for all instances of service identity. example% svcprop -q -p general/enabled identity: example% echo $? 0 Example 4: Waiting for Property Change This example waits for the sendmail instance to change state. example% svcprop -w -p restarter/state sendmail Example 5: Using svcprop in a Script example% cat getval #!/bin/sh svcprop -p $1 $2 | ( read value v2 if [ -n "$v2" ]; then echo "Multiple values!"; exit; fi echo $value ) The following exit values are returned: 0 Successful completion. 1 An error occurred. 2 Invalid command line options were specified. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ svcs(1), inetd(1M), svcadm(1M), svccfg(1M), svc.startd(1M), service_bundle(4), attributes(5), smf(5), smf_method(5), smf_security(5) 18 Mar 2005 svcprop(1)
All times are GMT -4. The time now is 02:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy