LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Regular expression in Ubuntu (http://www.linuxquestions.org/questions/programming-9/regular-expression-in-ubuntu-862795/)

flamingo_l 02-15-2011 04:56 AM

Regular expression in Ubuntu
 
hi,

Am using Ubuntu 10.10 operating system.

The following command would remove the leading astericks, spaces, slashes, tabs and is present in an awk script.

Code:

gsub(/^[/* \t]*/,"")
The above code is working fine when i run in Cygwin on windows machine. But when i run in Ubuntum throws the following error.

Code:

awk: ./Format.awk: line 30: regular expression compile failed (bad class -- [], [^] or [)
^[
awk: 30: unexpected character '\'
awk: ./Format.awk: line 30: runaway regular expression /,""); ...


Please help me in resolving this error.

grail 02-15-2011 05:57 AM

Knowing Ubuntu, this is because the default awk variation is actually mawk, in my opinion a rather sub standard version.
Try removing this and installing gawk and see if the error still persists?

flamingo_l 02-16-2011 10:33 PM

hi,

The problem is solved problem by downloading gawk package in Ubuntu... :)


All times are GMT -5. The time now is 06:49 AM.