[H-GEN] Formatting of ls (grep??)

Greg Black gjb at gbch.net
Sun Apr 18 07:22:20 EDT 2004


On 2004-04-18, Paul Clarke wrote:

> The entries from the la -la that I want to display all have the name in
> the format of a domain and basically look like:
> 
> lrwxrwxrwx 1 root root 23 Jul 10 2003 sitedynamics.com.au ->
> home/virtual/site4/fst
> 
> Ideally I want to display just these lines as:
> 4 sitedynamics.com.au
> 
> So that the user then inputs 4 if that is the site that they want. The 4
> comes from the siteX in the path.

If you pipe that into the following incantation, you'll get the
result you want.  I suspect that you haven't fully specified
what you need, so it may need to be tweaked a bit.

    | awk '{print $11,$9}' | sed -e 's,^[^ ]*site,,' -e 's,/.* , ,'

Cheers, Greg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 249 bytes
Desc: not available
URL: <http://lists.humbug.org.au/pipermail/general/attachments/20040418/d9e334db/attachment.sig>


More information about the General mailing list