Unexpected EOF while matching `` ''

I am writing a script that has a command to execute, as shown below:

cat /abc | grep -v ^# | grep -i root  | sed -e '\''s/"//g'\'' | awk '\''{print $2}'\''

When I run the script on SunOS, I get the following error:

test: line 1: unexpected EOF while looking for matching `"'
test: line 3: syntax error: unexpected end of file

Tried with another option .. but no luck.

I need someone to help me determine what is missing in the above command.

+5
source share
2 answers

what are these shoots ?!

cat /abc | grep -v '^#' | grep -i root | sed -e '\''s/"//g'\'' | awk '\''{print $2}'\''
                                                 ^         ^          ^             ^

Your problem:

sed -e '\''s/"//g'\''
             ^ unmatched
+2
source

- . , , , ? , , , , .

" " , script. :

grep -v ^# /abc | grep -i root | sed -e 's/"//g' | awk '{print $2}'

...

awk '/^#/ { next } /[Rr][Oo][Oo][Tt]/ { gsub ("\"",""); print $2 }' /abc

awk sed , . script, ; , ​​ , : echo '"'"'". echos " ( ), ' ( ).

; ; . gsub awk script .

0

All Articles