|
|
Braces within a string
I have a problem where I have a fixed field (i.e., $12) that contains either
a string (i.e., JOE) or a string enclosed in braces (i.e., {JOE IS NOT
HERE}) I am having trouble using gsub or gensub in awk to change the field
to something I can use. I can't access the filed properly if there is
multiple words in the field. Is there a good way of changing the braced
string with a constant? (i.e., {JOE IS NOT HERE} changes to TEST)
|
|
0
|
|
|
|
Reply
|
Jim
|
7/9/2003 4:38:07 AM |
|
In article <P_MOa.189284$nr.8544198@twister.southeast.rr.com>,
Jim <jshelby@nc.rr.com> wrote:
>I have a problem where I have a fixed field (i.e., $12) that contains either
>a string (i.e., JOE) or a string enclosed in braces (i.e., {JOE IS NOT
>HERE}) I am having trouble using gsub or gensub in awk to change the field
>to something I can use. I can't access the filed properly if there is
>multiple words in the field. Is there a good way of changing the braced
>string with a constant? (i.e., {JOE IS NOT HERE} changes to TEST)
>
>
how about something like this:
sub(/[{][^}][^}]*[}]/,"TEST",$0)
Chuck Demas
--
Eat Healthy | _ _ | Nothing would be done at all,
Stay Fit | @ @ | If a man waited to do it so well,
Die Anyway | v | That no one could find fault with it.
demas@theworld.com | \___/ | http://world.std.com/~cpd
|
|
0
|
|
|
|
Reply
|
demas
|
7/9/2003 11:07:15 PM
|
|
|
1 Replies
297 Views
(page loaded in 0.032 seconds)
Similiar Articles: Braces within a string - comp.lang.awkI have a problem where I have a fixed field (i.e., $12) that contains either a string (i.e., JOE) or a string enclosed in braces (i.e., {JOE IS NOT HE... finding a quote in a text string - comp.databases.filemaker ...Braces within a string - comp.lang.awk finding a quote in a text string - comp.databases.filemaker ... Braces within a string - comp.lang.awk A file name is a user-visible ... (sh/bash) How to check for a string matching -*? - comp.unix.shell ...Currently, I use case/esac to test to see if a string starts with a dash ... Braces within a string - comp.lang.awk split bash variable by semicolon ... Match split words - comp.text.pdf... comp.unix.shell ... > So you > need to return false for a match, and then ... Removing between words with sed - comp.unix.shell sed ... Braces within a string - comp.lang ... Help with JList and JComboBox - comp.lang.java.gui... Create some items to add to the list String listData ... It only misses the 2 closing braces. I have a JList. ... box its own container, rather than having it within the ... Find elements in a cell array and index the cell number - comp ...Find a string in a cell array - comp.soft-sys.matlab Find ... comp.soft-sys.matlab find / ismember / index within ... elements of cell array - comp.soft-sys.matlab... braces ... split bash variable by semicolon - comp.lang.awk... FICHEIRO" > > No need for split() (or spurious semicolons and braces ... am 3rd elem = tre saim I want to acess the header variable inside awk ... how split a string in ... Calling a method - comp.lang.java.helppublic String toSetString() { String setString ... int j) > { > if(validEntry(j)) braces ... > int i, j; You should declare i inside the for loop ... repmat elements of cell array - comp.soft-sys.matlab... it replicates the whole cell and not the elements within ... Second, you need to use curly braces to access elements ... Concat string to cell array of strings - comp.soft-sys ... Error while evaluating TimerFCN for timer 'timer-1' - comp.soft ...... the name of the callback function in curly braces to ... InstrumentSubscriptionCheckConnection(obj, event, string ... I stepped into it within the debugger as a lazy man's ... C#: Escape Curly Braces within Formatted String « Code Relief .NETProblem. When passing in a formatted string as an argument to a method such as Console.WriteLine, String.Format, etc., curly braces have a special meaning. Braces within a string - comp.lang.awk | Computer GroupI have a problem where I have a fixed field (i.e., $12) that contains either a string (i.e., JOE) or a string enclosed in braces (i.e., {JOE IS NOT HE... 7/23/2012 5:30:44 PM
|
|
|
|
|
|
|
|
|