Tuesday, February 27, 2007

Extracting top level dir names

A very simple post! This is for those who "just" started awk, others can skip :-)

Suppose dir.names contain the following data
$ cat dir.names

Purpose is to extract the top level directory names i.e.

$ awk -F "/" '{print "/"$2}' dir.names | sort | uniq

No comments:

© Jadu Saikia www.UNIXCL.com