Joe Terranova on 9 Nov 2009 11:27:04 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] extended 'cut' functionality?


Can you just reverse the string?

cd `perldoc -l Some::module | rev | cut 3 | rev`

On Mon, Nov 9, 2009 at 2:16 PM, Randall A Sindlinger
<rsindlin+plug@seas.upenn.edu> wrote:
> Hi folks,
>
> Quick (stupid) question.
>
> The 'cut' utility will let me do trivial string manipulation counting
> from the beginning of a string.
>
> Is there anything that provides similar, but extended, functionality to
> count from the _end_ of a string?
>
> Specifically, I'd like to be able to
>  cd `perldoc -l Some::module | cut-from-end 3`
>
> Sure, I know there are other things I could do, like doing
>  cut -d . -f 1
> or an awk thing, but both of those just don't feel "right".  It should
> be trivial to snip off the end of a string from the command line.
>
> I'd google it, but I can't imagine the crud I'd have to wade through.
>
> -Randall
>
> ___________________________________________________________________________
> Philadelphia Linux Users Group         --        http://www.phillylinux.org
> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
>
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug