Forum: Cfengine Help Subject: Re: Reading/Importing Just one line from csv file Author: Beto Link to topic: https://cfengine.com/forum/read.php?3,22039,22041#msg-22041
One way to do it is to use the comment parameter of readstringarray to ignore all the lines except the one you want. Here's an example reading /etc/passwd: # Put all users in /etc/passwd into the array "HomeDir", excluding # uids 1-199, nobody (-2), oracle (204), applmgr (205), hpsmh (430), # nfsnobody (65534, 4294967294) and ids (1000). "HomeDirn" int => readstringarray( "HomeDir", "/etc/passwd", "[^\n]*:[*x]:([1-9]|\d{2}|1\d{1,2}|-2|204|205|430|65534|4294967294|1000):[^\n]*", ":", "300", "12000" ); You could also use readstringlist and the grep function to find the line you're interested in. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine