[PLUG] cut delimiter question

Rick rdoyle16+plug at gmail.com
Mon Jun 11 16:08:48 UTC 2012


I'm not completely clear on what you're trying to accomplish, so forgive me
if I'm off base with these, but here are a couple of thoughts...

As far as I know, cut cannot deal with multiple delimiters... nor can it
handle a single delimiter consisting of multiple characters.

`ls -1` (that's a "one", not an "L") will give you a listing of just the
file names, each on a separate line

If you are trying to pull out more fields than just the filenames, try
using `cut -c8-12,25-` (replacing the numbers with the appropriate
values)... this example will give you chars 8 through 12 and 25 through the
end of each line. If using `ls -l`, the fields are fixed-length (other than
file name, but that is the last field), so this should be useful. Perhaps
more usefulness can be gotten out of this by using some of the formatting
and other options for the ls command.

Hope something here helps,
Rick

On Mon, Jun 11, 2012 at 8:23 AM, Rich Shepard <rshepard at appl-ecosys.com>wrote:

> On Mon, 11 Jun 2012, Chris Berry wrote:
>
> > I would generally use awk to do that, something like this:
> > ls -alh | awk '{print $9 }'
>
> Chris,
>
>   I thought of that but figured cut would be the better way. Apparenly not.
>
> Thanks,
>
> Rich
>
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list