(imported comment written by MarkA.Stevens)
How to parse /etc/passwd which is delimited by colons ( This allows you to:
-
Get any text between colons.
-
Get one or more parts of a delimited record, colons, commas, whatever you don’t want. Example: replace
:
with
,
I Hope This Helps
Q: (parenthesized part 1 of it ; parenthesized part 7 of it) of (matches (regex "
(
:+)
:
+)
:
+)
:
+)
:
+)
^:
+):(.*)$") of (lines of file “/etc/passwd” as string))
A: root
A: /sbin/sh
A: adm
A:
…
A: bigfix
A: /usr/bin/ksh
A: stevenam
A: /usr/bin/bash
T: 20602869
I’m trying to use this to find one file (for starters) and getting what seems to be inconsistent results between two Unices and two different versions of the dubugger. I know, two equations and two unknowns makes for a difficult solution. I’m stuck with 7.2.x for Solaris, but the 255 character limit is driving me nuts, so I thought I’d attempt to solve the problem on Linux, which doesn’t have that problem in the debugger.
Note: Not every account/userid has .profile or other files I will be searching for.
- Solaris:
-bash-3.00$ su -
Password:
Oracle Corporation SunOS 5.10 Generic Patch January 2005
Running BES Client:
PKGINST: BESagent
NAME: BigFix Agent
VERSION: 7.2.4.60
- uname -a
SunOS sonny 5.10 Generic_142910-17 i86pc i386 i86pc
- startqna
BESClientActionMastheadPath not set, using /etc/opt/BESClient/actionsite.afxm
Q: (files “.profile” of folder it) of ((parenthesized part 6 of it) of (matches (regex "
(
:+)
:
+)
:
+)
:
+)
:
+)
^:
+):(.*)$") of (lines of file “/etc/passwd” as string)) as string)
A: //.profile
A: //.profile
A: //.profile
A: //.profile
A: //.profile
A: //.profile
A: //.profile
A: //.profile
A: //.profile
A: /export/home/bigfix/.profile
A: /export/home/dadrian/.profile
A: /export/home/stevenam/.profile
T: 7393527
- Red Hat Linux
$ sudo su -
Password:
Sorry, try again.
Password:
Running BES Client:
Name : BESAgent Relocations: (not relocatable)
Version : 8.0.584.0 Vendor: BigFix, Inc.
root@clifford ~
uname -a
Linux clifford.localdomain 2.6.18-164.el5 #1 SMP Thu Sep 3 02:16:47 EDT 2009 i686 i686 i386 GNU/Linux
root@clifford ~
startqna
BESClientActionMastheadPath not set, using /etc/opt/BESClient/actionsite.afxm
Q: (files “.profile” of folder it) of ((parenthesized part 6 of it) of (matches (regex "
(
:+)
:
+)
:
+)
:
+)
:
+)
^:
+):(.*)$") of (lines of file “/etc/passwd” as string)) as string)
A: /root/.profile
E: Singular expression refers to nonexistent object.
T: 7193