Sponsored Content
Full Discussion: Get value between brackets
Top Forums Shell Programming and Scripting Get value between brackets Post 302491070 by durden_tyler on Wednesday 26th of January 2011 04:16:15 PM
Old 01-26-2011
Quote:
Originally Posted by nimo
...

4 ETW000 Disconnected from database.
4 ETW000 End of Transport (0000).
4 ETW000 date&time: 13.01.2011 - 08:03:28


I need to capture the value between brackets to be able to compare it to another one and make a decision. In this case, it is 0000.
...
Code:
$
$
$ cat f2
4 ETW000 Disconnected from database.
4 ETW000 End of Transport (0000).
4 ETW000 date&time: 13.01.2011 - 08:03:28
$
$
$ perl -lne 'print $1 if /^.*End of Transport \((.*)\)\.$/' f2
0000
$
$

tyler_durden
 

10 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Angle brackets

From the Apache thread in the Adanced forum: Thats because your browser interprets anything within angle brackets to be an HTML tag. You need to quote these brackets if you want them to appear correctly. The proper quotes are: &amp;lt; for < and &amp;gt; for > So, for example, you would have... (1 Reply)
Discussion started by: PxT
1 Replies

2. Shell Programming and Scripting

how do you use brackets ?? in a script.

:D i am pretty much new to scripting and don't want to pick up bad habits so I am trying to get myself to use brackets in my scripts since I plan on using them alot.. ! in this example of a script I wrote I can not figure out where the brackets go can anyone give me some insight into the use of... (3 Replies)
Discussion started by: moxxx68
3 Replies

3. UNIX for Dummies Questions & Answers

usage of brackets for if

Hi, I would like to know about the usage of brackets to negate a set of boolean evaluations an equivalent to what i am trying is below if or || ] ] then echo"valid time of day" else echo "invalid input" exit fi the bracket structue as mentioned doesnt work .. i am using ksh.... (4 Replies)
Discussion started by: lakshmikanth
4 Replies

4. Shell Programming and Scripting

help to delete brackets [ ]

hi all, i want to delete brackets in all the file and to keep the string or data between them ( example Q --> Qxxx) with sed command.. thanks (4 Replies)
Discussion started by: kamel.seg
4 Replies

5. UNIX for Dummies Questions & Answers

question about brackets ()

Hello guys, I'm brand new to UNIX. I've installed Cygwin as recommended, but here are some problems. Well, man command doesn't work and I also don't know how to create a file or even how to type (). With () the program gives me an error message. Please tell me how to do all these things. Best... (4 Replies)
Discussion started by: wadem
4 Replies

6. Shell Programming and Scripting

How to get the value in the first brackets

Hello, I am trying to write a script using ksh. And I want to get the value within the first brackets of a string. For example: 14/04/11 11:35: 00 This is (nn) from the earth. Then i hope to get nn in this case. Can any one advise me how to implement it? Thank you very much! nn (2 Replies)
Discussion started by: n_n
2 Replies

7. Shell Programming and Scripting

Delete text between square brackets and also delete those square brackets using sed or awk

Hi All, I have a text file which looks like this: computer programming systems engineering I want to get rid of these square brackets and also the text that is inside these brackets. So that my final text file looks like this: computer programming systems engineering I am using... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies

8. Shell Programming and Scripting

adding brackets

Hi, If you suppose that you have two columns of numbers, and I want to merge these two columns into one and put a bracket around it. and perphaps add a dash between two numbers. input.txt 1 2 3 4 5 6 7 8 output.txt (1-2) (3-4) (5-6) (7-8) Thanks in advance! Please use... (2 Replies)
Discussion started by: johnkim0806
2 Replies

9. Shell Programming and Scripting

Brackets

Hi all. i need a small help. i have written an exit code, which will check whether mo.sh is successful or not. if the status is >0 it will exit the shell. 1>Do you guys think it is a correct way to write? 2>what if i change the double bracket to single. how will it change the o/p. ... (1 Reply)
Discussion started by: sub
1 Replies

10. Shell Programming and Scripting

Capture the value between brackets

Hi I am having hard time getting this right and need some help. I Have 3 files, and everyone contains the following:- File1 Today, we have Name(Jack) Age(19) Class (A2) Today, we have Name(Kim) Class (G9) File2 Today, we have Name(Lee) Age(19) Class (A2) Today, we have... (8 Replies)
Discussion started by: samsan
8 Replies
PCP.CONF(5)							File Formats Manual						       PCP.CONF(5)

NAME
pcp.conf - the Performance Co-Pilot configuration and environment file SYNOPSIS
/etc/pcp.conf DESCRIPTION
When using Performance Co-Pilot (PCP) tools and utilities and when calling PCP library functions, a standard set of environment variables are defined in /etc/pcp.conf. These variables are generally used to specify the location of various PCP pieces in the file system and may be loaded into shell scripts by sourcing the /etc/pcp.env(5) shell script and queried by C/C++ programs using the pmGetConfig(3) library function. If a variable is already defined in the environment, the values in pcp.conf do not override those values, i.e. the values in pcp.conf serve as installation defaults only. Both the pcp.env and pcp.conf files are expected to be found in /etc by default. If required, the pcp.conf file may be relocated and PCP_CONF set in the environment to specify the full path to the new location. The pcp.env file can not be relocated (this is the only hard coded path required by PCP). The syntax rules for pcp.conf are as follows : 1. the general syntax is PCP_VARIABLE_NAME=variable value to end of line 2. lines that begin with # and all blank lines are ignored. 3. all variables must be prefixed with PCP_. This is a security issue - variables that do not have this prefix will be silently ignored. 4. there should be no space between the variable name and the literal = and no space between the = and the variable value (unless the value actually starts with a space). This is required because the pcp.conf file may be sourced directly by Makefiles as well as inter- preted by the pcp.env script and the pmGetConfig function. 5. variable values may contain spaces and should not be quoted. The pcp.env script automatically quotes all variable values from the character immediately following the = through to the end of the line. For further details and an explanation of the use of each variable, see the comments in the /etc/pcp.conf file itself. ENVIRONMENT
The PCP_CONF environment variable specifies an alternative path to the pcp.conf file. SEE ALSO
PCPIntro(1), PCPIntro(3), PMAPI(3), pmGetConfig(3) and pcp.env(5). Performance Co-Pilot PCP PCP.CONF(5)
All times are GMT -4. The time now is 07:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy