Sponsored Content
Top Forums Shell Programming and Scripting How to get the value in the first brackets Post 302513834 by n_n on Thursday 14th of April 2011 07:18:09 AM
Old 04-14-2011
Thank you Yogesh!
I tried your suggest with a string like below:
Code:
echo "13/04/11 12:09:05 NN 4 TEST1 TEST2: Name(NN) TEST3(string2) TEST4(string3) TEST5(string4) TEST6(string5) TEST7(string6) TEST8(string7) TEST9(string8)" | perl -nl -e

But I got:
Code:
/\((.*?)\)/: nested *?+ in regexp at /tmp/perl-eEPmcqa line 1.

Then i got a message:
Code:
'm/\((.*?)\)/; print $1;'

Is possible to use awk or sed to get NN within NAME()? The string can be very different. The purpose is to get the value within the first brackets.

Thank you very much!!!
nn

---------- Post updated at 06:18 AM ---------- Previous update was at 06:13 AM ----------

Sorry, it works!!! The previous error is a problem of the OS. Now it fixed and the command works.

Many thanks again, Yogesh!

Best Regards,
nn

Last edited by Franklin52; 04-14-2011 at 08:40 AM.. Reason: Please use code tags
 

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

Get value between brackets

Hi I am having hard time getting this right and need some help. I Have several log files, and everyone contains the following 3 lines at the end: 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... (7 Replies)
Discussion started by: nimo
7 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
IRSEND(1)							   User Commands							 IRSEND(1)

NAME
irsend - basic LIRC program to send infra-red commands SYNOPSIS
irsend [options] DIRECTIVE REMOTE CODE [CODE...] DESCRIPTION
Asks the lircd daemon to send one or more CIR (Consumer Infra-Red) commands. This is intended for remote control of electronic devices such as TV boxes, HiFi sets, etc. DIRECTIVE can be: SEND_ONCE - send CODE [CODE ...] once SEND_START - start repeating CODE SEND_STOP - stop repeating CODE LIST - list configured remote items SET_TRANSMITTERS - set transmitters NUM [NUM ...] SIMULATE - simulate IR event REMOTE is the name of a remote, as described in the lircd configuration file. CODE is the name of a remote control key of REMOTE, as it appears in the lircd configuration file. NUM is the transmitter number of the hardware device. For the LIST DIRECTIVE, REMOTE and/or CODE can be empty: LIST "" "" - list all configured remote names LIST REMOTE "" - list all codes of REMOTE LIST REMOTE CODE - list only CODE of REMOTE The SIMULATE command only works if it has been explicitly enabled in lircd. -h --help display usage summary -v --version display version -d --device use given lircd socket [/var/run/lirc/lircd] -a --address=host[:port] connect to lircd at this address -# --count=n send command n times EXAMPLES
irsend LIST DenonTuner "" irsend SEND_ONCE DenonTuner PROG-SCAN irsend SEND_ONCE OnkyoAmpli VOL-UP VOL-UP VOL-UP VOL-UP irsend SEND_START OnkyoAmpli VOL-DOWN ; sleep 3 irsend SEND_STOP OnkyoAmpli VOL-DOWN irsend SET_TRANSMITTERS 1 irsend SET_TRANSMITTERS 1 3 4 irsend SIMULATE "0000000000000476 00 OK TECHNISAT_ST3004S" FILES
/etc/lirc/lircd.conf Default lircd configuration file. It should contain all the remotes, their infra-red codes and the corresponding timing and wave- form details. DIAGNOSTICS
If lircd is not running (or /var/run/lirc/lircd lacks write permissions) irsend aborts with the following diagnostics: "irsend: could not connect to socket" "irsend: Connection refused" (or "Permission denied"). SEE ALSO
The documentation for lirc is maintained as html pages. They are located under html/ in the documentation directory. lircd(8), mode2(1), smode2(1), xmode2(1), irrecord(1), irw(1), http://www.lirc.org. irsend 0.9.0-pre1 October 2010 IRSEND(1)
All times are GMT -4. The time now is 07:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy