1
I wanted to write a shell script in which it needs to give the group name whose GID=0.I used awk command like this,
awk -F ':' {$3==0} /etc/group | cut -d ':' -f1
It works fine in redhat,aix.But not worked in Solaris. It throws error like awk: syntax error near line 1 awk: bailing out near line 1
I want to use /usr/bin/awk in solaris.How to modify this script according to old awk in solaris?
or can i use alternate approach to generalize this script in all linux platforms?
Try quoting the
awk
command script:awk -F ':' '{$3==0}' /etc/group …
. – Scott – 2015-03-25T10:05:03.927awk: syntax error near line 1 awk: bailing out near line 1 I tried that in solaris.It shows error like this. – user1507 – 2015-03-25T10:06:34.560
Is there any other command other than awk to get the output for this case? – user1507 – 2015-03-25T10:07:15.087
That was quick. … … … … … … … … You could probably use
sed
orperl
. – Scott – 2015-03-25T10:08:23.280can we able to check the condition like if GID=0 print the group name using sed? – user1507 – 2015-03-25T10:10:20.483
The answer is probably yes. – Scott – 2015-03-25T10:11:32.437
I am a newbee can you tell some outlined format to use sed to match this condition? – user1507 – 2015-03-25T10:15:27.583
Try doing some independent research:
man
, Google. Just searching Super User will yield a few nuggets (but also some gravel). – Scott – 2015-03-25T10:18:16.740