Grep only gids from /etc/passwd
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I want to grep
only group IDs from /etc/passwd
. Now I only came up how to grep the names, with:
grep -oE '^[^:]+' /etc/passwd
which gives me:
[frynio@manjaro ~]$ grep -oE '^[^:]+' /etc/passwd
root
nobody
dbus
bin
daemon
mail
ftp
http
systemd-journal-remote
systemd-coredump
uuidd
dnsmasq
rpc
usbmux
avahi
colord
cups
deluge
git
lightdm
nm-openconnect
nm-openvpn
ntp
polkitd
frynio
How can I change this regex, to omit the first three :
s and then start matching with [^:]+
? (cuz the ^
before it matches the beginning of the line, that's why I can extract the names, and I want something to match the position after 3 colons)
linux grep
add a comment |Â
up vote
0
down vote
favorite
I want to grep
only group IDs from /etc/passwd
. Now I only came up how to grep the names, with:
grep -oE '^[^:]+' /etc/passwd
which gives me:
[frynio@manjaro ~]$ grep -oE '^[^:]+' /etc/passwd
root
nobody
dbus
bin
daemon
mail
ftp
http
systemd-journal-remote
systemd-coredump
uuidd
dnsmasq
rpc
usbmux
avahi
colord
cups
deluge
git
lightdm
nm-openconnect
nm-openvpn
ntp
polkitd
frynio
How can I change this regex, to omit the first three :
s and then start matching with [^:]+
? (cuz the ^
before it matches the beginning of the line, that's why I can extract the names, and I want something to match the position after 3 colons)
linux grep
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want to grep
only group IDs from /etc/passwd
. Now I only came up how to grep the names, with:
grep -oE '^[^:]+' /etc/passwd
which gives me:
[frynio@manjaro ~]$ grep -oE '^[^:]+' /etc/passwd
root
nobody
dbus
bin
daemon
mail
ftp
http
systemd-journal-remote
systemd-coredump
uuidd
dnsmasq
rpc
usbmux
avahi
colord
cups
deluge
git
lightdm
nm-openconnect
nm-openvpn
ntp
polkitd
frynio
How can I change this regex, to omit the first three :
s and then start matching with [^:]+
? (cuz the ^
before it matches the beginning of the line, that's why I can extract the names, and I want something to match the position after 3 colons)
linux grep
I want to grep
only group IDs from /etc/passwd
. Now I only came up how to grep the names, with:
grep -oE '^[^:]+' /etc/passwd
which gives me:
[frynio@manjaro ~]$ grep -oE '^[^:]+' /etc/passwd
root
nobody
dbus
bin
daemon
mail
ftp
http
systemd-journal-remote
systemd-coredump
uuidd
dnsmasq
rpc
usbmux
avahi
colord
cups
deluge
git
lightdm
nm-openconnect
nm-openvpn
ntp
polkitd
frynio
How can I change this regex, to omit the first three :
s and then start matching with [^:]+
? (cuz the ^
before it matches the beginning of the line, that's why I can extract the names, and I want something to match the position after 3 colons)
linux grep
linux grep
asked 4 mins ago
Frynio
1273
1273
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f478296%2fgrep-only-gids-from-etc-passwd%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password