-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
In <[EMAIL PROTECTED]>, Anupam Jain wrote:
>On Tue, Jul 29, 2008 at 2:52 PM, Puneet Lakhina
><[EMAIL PROTECTED]> wrote:
[snip]
>> You should use something like following if you dont have printf
>>
>> find /home/user -type d | sed 's/^\/home\/user//g' | awk -F'/' '{print NF-1
>> "\n"}' | sort -n | tail -1
>>
>> essentially remove out the base search path from the find result strings.
>
>Interesting! Now the question is - is there a way to *painlessly*
>specify the directory argument (/home/user in this case) only *once*
>and get the same result? Even if I put this one liner in a shell
>script and refer to $1 in both places, it seems I will still need to
>escape slashes before passing it to sed and another sed expression
>would make this nice one liner a bit clutzy.
Or if your shell is bash, then you can check out bash(1)'s parameter expansion
which will help you in avoiding sed.
Ashish
- --
·-- ·- ···· ·--- ·- ···- ·- ·--·-· --· -- ·- ·· ·-·· ·-·-·- -·-· --- --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
iEYEARECAAYFAkiO+1kACgkQHy+EEHYuXnQ29wCdGGvSluSW2AXsVvkotcYNXR0+
HK4AniLCBFU1zJF325PiCkNN0bFyIQhc
=dclU
-----END PGP SIGNATURE-----
_______________________________________________
ilugd mailinglist -- [email protected]
http://frodo.hserus.net/mailman/listinfo/ilugd
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi
http://www.mail-archive.com/[email protected]/