Sponsored Content
Top Forums Shell Programming and Scripting Doubt with regex to replace square bracket Post 302754001 by Syed Imran on Wednesday 9th of January 2013 11:43:03 PM
Old 01-10-2013
Wrench Doubt with regex to replace square bracket

there is a word "welcome[world]"
output should be "welcome\[world\]

i am using regsub to add backslash "\" in place where ever i find square brackets (open or close)..
But i am not getting it... pls help out..

set a {welcome[world]}
set d [regsub -all "(?q)\[" "$a" /\[]
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

doubt regardin regex in grep

shudnt this command : grep test give all the lines which do not hv 'C'. ^ wrks as negating character inside square brackets right ??? bt in my case grep is printin all the line in the file also wht does grep c+ test & grep c? test shud do ??? (4 Replies)
Discussion started by: evergreen_cool
4 Replies

2. Shell Programming and Scripting

Extract string in square bracket

Hi Input text is some message some message some message Expected output is main value1 value2 value3 Any idea how to above values in square brackets using shell scripting? many thanks. (3 Replies)
Discussion started by: hnh
3 Replies

3. UNIX for Dummies Questions & Answers

replace line after a regex

Hi, I am trying to write a script which will modify a given account's settings by searching for a line in a file and then replacing the line after it. Here is a portion of my input file: type=friend username=0002 secret=password host=dynamic dtmfmode=rfc2833 mailbox=0002 context=sip... (2 Replies)
Discussion started by: the1armedcoder
2 Replies

4. Shell Programming and Scripting

Expect Script square bracket dollar prompt

Hi Thanks for this amazing forum first, I've been searching answers in it for problems that I've encountered at work. The only problem I haven't been able to find a fix for, is a ever waiting for prompt problem in Expect when encounter a $ prompt. I usually set the timeout to -1 cause the... (2 Replies)
Discussion started by: Ikaro0
2 Replies

5. Shell Programming and Scripting

Group on the basis of common text in the square bracket and sorting

File A 99 >ac >ss >juk 70 >acb >defa 90 >ca 100 >aa >abc >bca 85 >cde 81 >ghi >ghij 87 >def >fgh <ijk 89 >fck >ghij >kill >aa The given output shud be 100 >aa >abc >bca 87 >def >fgh <ijk 89 >fck >ghij >kill >aa (2 Replies)
Discussion started by: cdfd123
2 Replies

6. Shell Programming and Scripting

Doubt on RegEx

Friends, I have a silly doubt: Assume that I have a line like this Heading: Value1; SomeText1 (a, b, c), Value 2; SomeText2 (d, e, f) I wanted to remove all semicolon and remove everything in brackets (including brackets). I managed to do this using this code if... (1 Reply)
Discussion started by: dahlia84
1 Replies

7. Emergency UNIX and Linux Support

search replace regex question

Hi, I need to run a search and replace on a large database, what I need to change is all instances of #### (eg. 1764 or 1964) to (####) (eg. (1764) or (1964)) But there might be other numbers in there such as (1764) and I do not need those changed to ((1764)) How can I... (7 Replies)
Discussion started by: lawstudent
7 Replies

8. Shell Programming and Scripting

ksh, difference between double bracket and single bracket

Can somebody tell me the difference between double brackets and single brackets, when doing a test. I have always been acustomed to using single brackets and have not encountered any issues to date. Why would somebody use double brackets. Ie if ] vs if Thanks to... (2 Replies)
Discussion started by: BeefStu
2 Replies

9. Shell Programming and Scripting

Regex - search and replace

I have file which contains data in the following format all in a single line: BDW_PUBLN_ID DECIMAL(18:0) NOT NULL PRIMARY INDEX ARGO_ACCT_DEP_PI ( OFC_ID ,CSHBX_ID ,TRXN_SEQ_NUM ,PROCG_DT ) PARTITION BY RANGE_N(PROCG_DT BETWEEN DATE '2012-03-01' AND DATE '2014-12-31' EACH INTERVAL '1' MONTH );... (4 Replies)
Discussion started by: ysvsr1
4 Replies

10. UNIX for Beginners Questions & Answers

Regex Expression Replace

I have a XML file where there is a tag with like <wd:address_line_1>1234 Street</wd:address_line_1> I want to replace the values "1234 Street" with "Test Data". Different people have different address lines and i want to replace with a fixed value to mask the file. I was trying to use sed... (7 Replies)
Discussion started by: dr46014
7 Replies
OPENFETION(1)															     OPENFETION(1)

NAME
openfetion - open source implementation of fetion protocol client SYNOPSIS
openfetion -f SOURCE -t DEST -d MESSAGE openfetion -f SOURCE -m -d MESSAGE openfetion -f SOURCE -p -t DEST -d MESSAGE openfetion -f SOURCE -g NUM DESCRIPTION
openfetion is a fetion client for Linux based on GTK+2.0, using Fetion Protocol Version 4. It supports most useful functions of China Mobile Fetion, more important, it's small and fast, and is better in look. -f specify which number you will use to send a message -t specify which number you will send a message to -d message you will send -m send a message to myself -p send a message to the phone -g get information of specific mobile number -h, -H display this help and exit EXAMPLES
send "hello world" to 18788888888: openfetion -f 15288888888 -t 1878888888 -d "hello world" send "hello world" to yourself: openfetion -m -f 15288888888 -d "hello world" get information of 18788888888: openfetion -f 15288888888 -g 1878888888 AUTHOR
Written by Aron Xu <happyaron.xu@gmail.com>. RESOURCES
openfetion home page: http://code.google.com/p/ofetion COPYING
Copyright (C) 2009 Aron Xu. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. 2010-12-26 OPENFETION(1)
All times are GMT -4. The time now is 12:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy