List attributes from Terminal

Hi. Is any way to see, from Terminal, more of one attribute from several files at once?

For example, if I have 3 people files, from Tracker I can see:

Name | Phone | EMail | Company

John 555-222 test@… MyCompany
Mery 555-111 mery@… Mery-Company
Carl 555-000 carl@… Carl-Company

Is any way to show the same information, from Terminal?

I know about catattr command, but I can list the value of only one attribute at the same time.

Any ideas?

Thanks in advance!

I think you’re not the only one who doesn’t know about the “-l” flag to listattr.

The result is of course not going to look anything like your picture, but you could fix that up with an awk script or something. Like …

function printline () {
if (rp[“name”])
print rp[“name”], rp[“wphone”], rp[“email”], rp[“company”]
split("", rp)
}
/^File:/ {
printline()
}
$3 ~ /META:/ { # “META:wphone” – in quotes, which is some extra trouble
k = substr($3, 7, length($3) - 7)
v = $4
for (i = 5, $i, ++i) {
v = v " " $i
rp[k] = v
}
END {
printline()
}

listattr -l * | awk -f awkfilename

That’s somewhat rudimentary and not 100% reliable, but you probably have a more specific idea in mind anyway.

[edited for typos]

Thank you very much!!! I didn’t know about the " -l " flag. With this and combined with grep is very close to what I need.

Also, thank you for the script example :slight_smile:

Regards!