On Sun, 30 Jan 2000, Niclas Hedhman wrote:
Niclas,
Absolutely! Here is how :
sed 's/^\.\///;s/^\.$//;s\//\./g'
...will do all the 'sed' manipulations in a single invocation. In
case you arent familiar with basic regular expressions, the '^' matches
the beginning of a line, and the '$' matches the end of a line. Thus,
'^\.$' will match a line consisting of nothing but a '.'.
As far as getting unique records go, use the 'uniq' command. This
is also equivalent to 'sort -u'.
Regards,
Kenneth
>
> Thanks,
> The -printf is much faster!
>
> Sed seem to be a great tool!!! Need to study that more.
>
> To do exactly what I want, I need 3 sed expressions...
> 's/\.\///g' removing the leading ./ of each directory
> 's/\.//g' removing the single ., for current directory
> 's/\//\./g' replacing the / with a .
>
> Instead of using 3 pipes, could this be expressed in a single invocation of
> sed? (Performance is not much of an issue, but I think it looks neater.)
>
> Just one more thing...
>
> I will get multiple lines that are equal. Is it possible to remove
> duplicates, in some easy way? (Of course, it's Linux! But how?)
>