Multiple field separators for paranthesis not working 
Author Message
 Multiple field separators for paranthesis not working

I am trying to read the string between the left and right paranthesis
in the following string:

bla bla CHANNEL(my_channel) bla bla

I tried the following syntacsi:
  awk '{print $1}' FS="[()]"
  awk '{print $1}' FS="[\(\)]"
  awk '{print $1}' FS="[^(^)]"

I also tried the version with single quotes for all of the above:
  awk '{print $1}' FS='[()]'

What am I doing wrong?

For your convenience:
echo "bla bla CHANNEL(my_channel) bla bla" | awk '{print $1}'
FS="[()]"
echo "bla bla CHANNEL(my_channel) bla bla" | awk '{print $1}'
FS="[\(\)]"
echo "bla bla CHANNEL(my_channel) bla bla" | awk '{print $1}'
FS="[^(^)]"



Wed, 10 Nov 2004 08:50:57 GMT  
 Multiple field separators for paranthesis not working


Quote:
> I am trying to read the string between the left and right paranthesis
> in the following string:

> bla bla CHANNEL(my_channel) bla bla

> I tried the following syntacsi:
>   awk '{print $1}' FS="[()]"
>   awk '{print $1}' FS="[\(\)]"
>   awk '{print $1}' FS="[^(^)]"

> I also tried the version with single quotes for all of the above:
>   awk '{print $1}' FS='[()]'

Try

    awk '{print $2}' FS='[()]'

Hint: that field seperater makes 3 fields of your example.

--
Frederick



Wed, 10 Nov 2004 08:59:10 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Field Separator not working

2. multiple field separators in AWK

3. Specifying multiple field separators

4. Dealing with commas as a field separator AND possibly within a field

5. Input field does not seem to work in foreign versions of Windows

6. Q: Reading file in multiple times not working!

7. Populate dictionary fields button does not work

8. timeout in multiple processes not working

9. Multiple Selection from a listbox: not working

10. multiple bindings does not work

11. Hexadecimal Field Separator

12. Field Separator

 

 
Powered by phpBB® Forum Software